Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Apache Tomcat »

MySql Connector

Mohammed Zabin

2007-07-22

Replies:

Hi All

I have confiured oracle connection pool on my tomacat 6, and it worked fine.
When i came to configure MySql, I repeated the same steps for Oracle
databse, with considering the specfication of MySql database. But it's
didn't work. Any Help please about configuring MySql,
I downloaded MySql connector from mysql website and place it in
CATALINA_HOME/lib directory, and i put the following:

1. in server.xml file:
<Resource name="jdbc/TestMySql" auth="Container" type="javax.sql.DataSource"
            maxActive="100" maxIdle="30" maxWait="10000"
            username="root" password="exam" driverClassName="
com.mysql.jdbc.Driver"

url="jdbc:mysql://localhost:3306/exam?autoReconnect=true"/>

2. in web.xml file
<resource-ref>
   <description>Oracle Datasource example</description>
   <res-ref-name>jdbc/TestMySql</res-ref-name>
   <res-type>javax.sql.DataSource</res-type>
   <res-auth>Container</res-auth>
</resource-ref>

3. in context.xml file (on server's context.xml file):
<Resource name="jdbc/TestMySql" auth="Container" type="javax.sql.DataSource"
            maxActive="100" maxIdle="30" maxWait="10000"
            username="root" password="exam" driverClassName="
com.mysql.jdbc.Driver"
            url="jdbc:mysql://localhost:3306/exam"/>

4. in cotext.xml file ( In my web application's context.xml file):
<ResourceLink global="jdbc/TestMySql" name="jdbc/TestMySql" type="
javax.sql.DataSource"/>

Any Help please?
©2008 junlu.com - Jax Systems, LLC, U.S.A.