No problem.

With a one to one, set up the dataresource in the context element of the app.

Place this after your context element. You will need to either declare one in the server.xml, in your app war file or create a file yourapp.xml and place it in the Tomcat dir:
tomcat_home/conf/Catalina/localhost or the matching host for the app.



<Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"/>

 <ResourceParams name="jdbc/TestDB">
   <parameter>
     <name>factory</name>
     <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
   </parameter>

   <parameter>
     <name>maxActive</name>
     <value>100</value>
   </parameter>

   <parameter>
     <name>maxIdle</name>
     <value>30</value>
   </parameter>

    <parameter>
     <name>maxWait</name>
     <value>10000</value>
   </parameter>

    <parameter>
    <name>username</name>
    <value>javauser</value>
   </parameter>
   <parameter>
    <name>password</name>
    <value>javadude</value>
   </parameter>

    <parameter>
      <name>driverClassName</name>
      <value>com.mysql.jdbc.Driver</value>
   </parameter>

   <parameter>
     <name>url</name>
     <value>jdbc:mysql://localhost:3306/javatest?autoReconnect=true</value>
   </parameter>
 </ResourceParams>

Make sure the resource name= resourceParams name= and the name called out in the class I sent in the last email all match including case.
Set the url to match the database name in place of javatest. And use the user and password you created for the database.


I create a user in the database and limit the rights to only the one databse and with limited rights.

Add this to the web.xml for the app:

  <resource-ref>
     <description>DB Connection</description>
     <res-ref-name>jdbc/TestDB</res-ref-name>
     <res-type>javax.sql.DataSource</res-type>
     <res-auth>Container</res-auth>
 </resource-ref>

Again match the res-ref-name to the name used above for the resource.

And that should get things talking if you have set up all the database and users.

The above examples are from:
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html

Good luck.
----- Original Message ----- From: "Krishnakant Mane" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
Sent: Wednesday, April 06, 2005 8:08 AM
Subject: Re: still not clear with connection pooling in tomcat



never mind doug,
in fact it seams that your asking questions reflects
nothing but professionalism and perfection.  that's
the way to do it.
by the way the relation to databases is one  to one
with web apps.  one web app is going to refer to only
one database.
so that is the way it is going to be.
thanks
Krishnakant.

Send instant messages to your online friends http://uk.messenger.yahoo.com

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






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



Reply via email to