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: <esql:connection> <esql:pool>foo</esql:pool> <esql:execute-query> ........ </esql:execute-query> </esql:connection> In the Cocoon.xconf file, you would add the following entry: <datasources> <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> </pool-controller> <driver>org.gjt.mm.mysql.Driver</driver> <dburl>jdbc:mysql://localhost:3306/eclipse</dburl> <!-- In your example these are not needed <user>mylogin</user> <password>myPassword</password> --> </jdbc> </datasources> > > <?xml version="1.0" encoding="ISO-8859-1"?> > > <xsp:page > language="java" > xmlns:xsp="http://apache.org/xsp" > xmlns:esql="http://apache.org/cocoon/SQL/v2" > > > <page> > > <title>A Database Driven XSP Page</title> > > <content> > > <esql:connection> > <esql:driver>org.gjt.mm.mysql.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. <http://xml.apache.org/cocoon/faqs.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>