Roberto wrote:

Dear sirs,
Im going to be crazy over this.
Since I installed Cocoon I never could connect to MySQL db. I did everything properly in the cocoon.xconf & in the web.xml trust me, I added the mysql-connector-java-3.0.6-stable-bin.jar under the ../WEB-INF/lib, but I got always the same error from error.log & sitemap.log:
ERROR (2004-11-16) 08:33.34:464 [sitemap.transformer.sql] (/montefiore/hellococoon) PoolThread-4/SQLTransformer.Query: Caught a SQLException
java.sql.SQLException: Failed to obtain connection. Made 5 attempts with 5000ms interval
(....)
I can connect to this source via other sistem. The MySQL service is started (got Windows 2000). I thought was the firewall that dosn't let me connect so I unistalled it but the problem is still the same.

Personnaly, doing just the following works fine : in cocoon.xconf, under <datasources> : <jdbc logger="core.datasources.anouncement" name="Myconnection"> <pool-controller max="10" min="5"/>

<auto-commit>true</auto-commit>

<dburl>jdbc:mysql://localhost:3306/mybase</dburl>

<user>mylogin</user>

<password>mypassword</password>

</jdbc>


In web.xml :

<init-param>

<param-name>load-class</param-name>

<param-value>

<!-- For parent ComponentManager sample:

org.apache.cocoon.samples.parentcm.Configurator -->

<!-- For IBM WebSphere:

com.ibm.servlet.classloader.Handler -->

<!-- For Database Driver: -->

org.hsqldb.jdbcDriver

<!-- For Mysql Database: -->

com.mysql.jdbc.Driver

</param-value>

</init-param>

And in your sitemap :

map:match pattern="DrawMyBase" >

<map:generate src="MyBase_sql.xml" />

<map:transform type="sql">

<map:parameter name="use-connection" value="Myconnection"/>

</map:transform>

<map:serialize/>

</map:match>

And as sample, this sql query (MyBase_sql.xml):

<?xml version="1.0"?>

<anouncement xmlns:sql="http://apache.org/cocoon/SQL/2.0";>

<execute-query xmlns="http://apache.org/cocoon/SQL/2.0";>

<query>

select TITLE, DESCRIPTION from books limit 5

</query>

</execute-query>

</anouncement>


Please can somebody help me I mean I guessIm not the only one that want to use MySQL as db... and another question how can I connect via JDBC-ODBC?

Only in the case there is no jdbc driver for your DB, you can use JDBC-ODBC bridge to connect to it with JDBC.
Go to http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/bridge.doc.html for further details.
Once you've created an ODBC datasource , (find administrative tools -> Datasources(ODBC) , choose your ODBC driver and configure the connection parameters), you can connect to it thru JDBC-ODBC driver bridge the same way as any JDBC driver, by providing datasourcename :
- add sun.jdbc.odbc.JdbcOdbcDriver in web.xml
- define connection in cocoon.xconf with :
<dburl>jdbc:odbc://[ODBCDataSourceName]</dburl>


Thanx in advance for any suggestion
Ciao
Roberto

Good luck

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to