cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <>
Subject Re: C2 MYSQL woes
Date Tue, 18 Dec 2001 14:19:13 GMT
Sharat Koya wrote:

> Hi, I have been trying for the past few days to setup MySQL with C2 in
> order to use ESQL in my application. Unfortunately I can't get past the
> configuration problems.
> I have installed MySQL and C2 on my WinXP machine. Do I need to setup a
> driver for tomcat so that C2 can access MySQL on local host or can I get
> away with just declaring it in my ESQL code. If I don't need to setup
> the driver I tried the following code but C2 keeps returning the error
> Resource Not Found (404). 
> Any help would be much appreciated.

You do have to make sure the JDBC driver for MySQL is in the classpath.
If you include it in your ${webapp}/WEB-INF/lib directory, make sure
the jar file ends in ".jar" because many servlet containers will not load
".zip" files.  If you include it in the ${java.home}/jre/lib/ext/ directory,
it will be available as well.  I would highly recommend *not* placing it
in the ServletContainer's lib directory, because the current Servlet
Containers separate the classes used for the server from the ones used
in the webapp context.

> Thanks
> Sharat Koya

If you create your ESQL code so that it uses a Connection pool, you will
notice your code being more performant:


In the Cocoon.xconf file, you would add the following entry:

    <jdbc name="foo">
      <pool-controller min="5" max="10">
        <!-- quick query used as a ping to the server to ensure
             the connection is alive.  If it doesn't work, set it
             to something that is app specific -->
        <keepalive>SELECT 1;</keepalive>

       <!-- In your example these are not needed



> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsp:page
>           language="java"
>           xmlns:xsp=""
> 	  xmlns:esql=""
>   <page>
>    <title>A Database Driven XSP Page</title>
>    <content>
> <esql:connection>
>                  <esql:driver></esql:driver>
> <esql:dburl>jdbc:mysql://localhost:3306/eclipse</esql:dburl>
>                  <esql:execute-query>
>                      <esql:query>select * from planet_data</esql:query>
>                      <esql:results>
>                          <esql:row-results>
>                          </esql:row-results>
>                      </esql:results>
>                      <esql:no-results>
>                          <section>Record not found</section>
>                      </esql:no-results>
>                      <esql:error-results>
>                          <section>Database error: <esql:get-message/>
>                          </section>
>                      </esql:error-results>
>                  </esql:execute-query>
>              </esql:connection>
> </content>
>   </page>
> </xsp:page>


"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin

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