I am struggling with getting a new server to communicate with a mySQL database
on another machine.
The database and queries work fine, when running on machine A, where the
database is installed,
as does the Cocoon application when running there.
However, when I try and emulate the Cocoon application on machine B
(same OS, same Cocoon version - Linux, C2.1.6),
I get a null pointer exception that I cannot seem to solve.
Here is what I have done.
1. Copied the mysql-connector-java-3.1.7-bin.jar file to
tomcat\webapps\cocoon\WEB-INF\lib\
2. Added an entry in web.xml for "com.mysql.jdbc.Driver"
3. Aded an entry in the cocoon.xconf for:
<jdbc name="mydb">
<pool-controller min="1" max="50"/>
<auto-commit>true</auto-commit>
<dburl>jdbc:mysql://dbserver.alias.com/mydbname</dburl>
<user>myuser</user>
<password>mypassword</password>
</jdbc>
4. Restarted Cocoon
5. Added a "myuser" entry to the mySQL user table on the database machine, with
USE mysql;
GRANT USAGE ON *.* to myuser@"99.99.99.99" IDENTIFIED BY 'mypassword';
GRANT SELECT ON mydbname.* to ffpreporter@"99.99.99.99";
(obviously I am using the actual IP address of Machine B)
6. The pipeline in question looks like:
<map:match pattern="testproject">
<map:generate src="sql.xml"/>
<!-- === SQL Connector ==== -->
<map:transform type="sql">
<map:parameter name="use-connection" value="mydb"/>
<map:parameter name="show-nr-of-rows" value="true"/>
<map:parameter name="clob-encoding" value="UTF-8"/>
</map:transform>
<map:serialize type="xml"/>
</map:match>
7. the SQL file contains:
<?xml version="1.0" encoding="UTF-8" ?>
<sq2:execute-query xmlns:sq2="http://apache.org/cocoon/SQL/2.0">
<sq2:query name="themes">
SELECT DISTINCT * FROM mytable
</sq2:query>
</sq2:execute-query>
8. The stacktrace from Cocoon is a java.lang.NullPointerException;
looking in the error.log reveals:
ERROR (2005-07-13) 12:40.11:694 [sitemap.transformer.sql]
(/cocoon/myapp/testproject) http-8080-Processor4/SQLTransformer.Query: Caught a
SQLException
java.sql.SQLException: Failed to obtain connection. Made 5 attempts with 5000ms
interval
How do I go about trying to pin down why this is happening?
Thanks
Derek
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]