My experience with mySql is:
- you need to have the good driver, typically in WEB-INF/lib, you need a jdbc connector found in http://dev.mysql.com/downloads/connector/j/3.0.html ; you could have some problem between version of connector and version of Java
- in WEB-INF/cocoon.xconf, you have to define the access to your database; for example:
<jdbc name="france">
<pool-controller min="5" max="10"/>
<dburl>jdbc:mysql://localhost:3306/france0104?autoReconnect=true</dburl>
<user>cestmoi</user>
<password>zzzzzz</password>
</jdbc>
where france is the name of the data source which will be used in the sitemap
the database is france104 and the access to the database is defined for the user cestmoi with the password zzzzzz
- in WEB-INF/web.xml, you have to define the connector used for mysql with something like
<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 MySQL Driver: --> com.mysql.jdbc.Driver
<!-- or use org.gjt.mm.mysql.Driver if you have the older 'Mark Matthews' driver-->
<!-- For Database Driver: --> org.hsqldb.jdbcDriver
</param-value>
</init-param>

Known problems:
- you need coherent versions: my config is JDK 1.5 with saxon8 and mysql-connector-java-3.0.16-ga-bin.jar in cocoon 2.2.0
- you could have some problems with the permissions defined for the database

Good luck

On 12/25/05, sergio del amo <[EMAIL PROTECTED]> wrote:
Hi,
I am trying to query a mysql database from my cocoon installation. I am
using Cocoon as a webapp of tomcat.
I made the next changes:

I added mysql Driver to 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-->

        <!-- Example for a MySQL database driver -->
        com.mysql.jdbc.Driver
        <!-- org.gjt.mm.mysql.Driver-->
        </param-value>
    </init-param>


I added an entry to cocoon.xconf:

   <jdbc name="mmis2">
      <pool-controller max="10" min="5"/>
      <auto-commit>true</auto-commit>
      <dburl>jdbc:mysql://localhost/mmis2</dburl>
      <user>user</user>
      <password>user123</password>
    </jdbc>

and a match pipeline to sitemap.xmap:

  <map:match pattern="index.html">
     <map:generate src="">     <map:transform type="sql">
         <map:parameter name="use-connection" value="mmis2"/>
     </map:transform>
     <map:serialize type="xml"/>
  </map:match>

query.xml is:

    <?xml version="1.0"?>
    <results xmlns:sql="http://apache.org/cocoon/SQL/2.0">
        <sql:execute-query xmlns:sql=" http://apache.org/cocoon/SQL/2.0">
            <sql:query>
              select * from collections
            </sql:query>
        </sql:execute-query>
    </results>

I copied the mysql connector (mysql-connector-java-3.0.16-ga-bin.jar) to
cocoon/WEB-INF/lib

I thought everything was well configured but i get always:

"Failed to obtain connection. Made 5 attempts with 5000ms interval"

Any clue, why i am still getting this error?

thanks in advanced for your future feedback and merry christmas!!
sergio


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




--
--
Jean-Claude Moissinac
Department of Computer Science and Networks
ENST Paris
FRANCE

E-mail: [EMAIL PROTECTED]
Tel: (+33) 1.45.81.80.88
Fax: (+33) 1.45.81.71.58

http://shadok.enst.fr/jcm