cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conrad F. D'Cruz" <>
Subject Try this Re: Can't connect to MySQL with Cocoon 2
Date Sun, 05 May 2002 13:35:41 GMT

Maybe I don't understand using databases with Cocoon after all.  Are you
the database for logging?  If not why did you define it in the <jdbc>
block in the xconf
file that way (as a logger)?

Here is what I did to get it working (and I got these steps from the

1) I put the mysql.jar file (which contains the mysql jdbc driver) in the
tomcat4.01/lib directory.
    I vaguely remember having trouble when it was in the
cocoon/WEB-INF/lib ... and once
    it started working I did not complain or spend additional time
researching why it failed
    down in the lower directory.

2) I created a jdbc block in the cocoon.xconf file as follows ...

       <jdbc name="mysql_pool">
         <pool-controller min="5" max="10"/>

where ... mydb is the (very creative) name I chose for the database.

3) In the webapps/cocoon/WEB-INF directory ... I put the following in
the web.xml file ...


        <!-- For MySQL on localhost-->

     <!-- For JDBC-ODBC Bridge: -->

        <!-- For parent ComponentManager sample:
        org.apache.cocoon.samples.parentcm.Configurator  -->

4) Finally I use the mysql_pool, as follows

In  the sitemap ... within the <map:pipeline>the transformer looks like

      <map:transform type="sql">
        <map:parameter name="use-connection" value="mysql_pool"/>

5) In the content source file for the <map:generator> component I have
this code ...
(note there is more than just this code in the file.  In the interest of
space I am just
showing the sql stuff)

  <execute-query xmlns="">
        select * from emp where name='Conrad'

(of course there was a table named emp in mydb ... and it was set up
correctly and
I made sure there was data in that table -- I verified everything from the
"mysql" console)

... then I fired up Cocoon (and prayed for a miracle!!).  The C2 gods must
been pleased with me that day ... because ... it worked!!!

I, however, did not have a bottle of champagne when I saw the data in my
browser ...
but it worked!! and I was not going to complain about format etc etc.
That is the
topic for another bottle of champagne :)

Hope that helps
Conrad wrote:

> Hello all,
> I have a problem connecting to a MySQL database with Cocoon. When I
> try to access a page that goes through the SQLTransformer, the browser
> doesn't deliver any result. There's no error message, the browser just
> sits there and waits for data. The Coccon core.log file contains an
> error message "No valid Jdbc Connection class available". (More
> details follow below.)
> I've checked Google, the mailing list archive, and the FAQs, but
> didn't find anything that seemed to help. I'm surely missing
> something; aynone out there can help me?
> Thanks,
> Daniel

Please check that your question has not already been answered in the
FAQ before posting. <>

To unsubscribe, e-mail: <>
For additional commands, e-mail: <>

View raw message