You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Hollerman Geralyn M <gm...@louisiana.edu> on 2005/01/14 23:29:25 UTC

question

I was recently given a new application to maitain. It uses Tomcat 5.0.16 and an 
Oracle database. I have used various versions of Tomcat to work with 
applications on two other kinds of databases, one of which uses DBCP, so I am 
somewhat familiar with the needed parameters and went to the Tomcat JNDI HOW-TO 
and the Tomcat Configuration Reference to refresh my memory on just what this 
was doing, but I have to admit I don't completely understand this - what I have 
included is the <Context>.xml file for the "new" application. What I don't 
understand is that first <ResourceParams> set of statements - it appears to be 
saying to look at the "database" of users in the tomcat-users.xml file in /conf 
- but why? That file hasn't been altered to contain anything but the defaults, 
and the person that gave me the "new" app was the one that set up Tomcat for it, 
so I assume its set up as needed! Also, why is there no factory in the 2nd 
<ResourceParams> in this file? I thought one was needed. The person that gave me 
this said DBCP was implemented, but I don't see how this would do it.
----
<Context docBase="graduate" path="/graduate">
   <Resource auth="Container" name="jdbc/ConnectionPool" type="javax.sql.DataSour
ce"/>
    <ResourceParams name="UserDatabase">
       <parameter>
         <name>factory</name>
         <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
       </parameter>
       <parameter>
         <name>pathname</name>
         <value>conf/tomcat-users.xml</value>
       </parameter>
     </ResourceParams>
     <ResourceParams name="jdbc/ConnectionPool">
       <parameter>
         <name>maxWait</name>
         <value>5000</value>
       </parameter>
       <parameter>
         <name>maxActive</name>
         <value>100</value>
       </parameter>
       <parameter>
         <name>password</name>
         <value>xxxx</value>
       </parameter>
       <parameter>
         <name>url</name>
         <value>jdbc:oracle:thin:@xxxx</value>
       </parameter>
       <parameter>
         <name>driverClassName</name>
         <value>oracle.jdbc.driver.OracleDriver</value>
       </parameter>
       <parameter>
         <name>maxIdle</name>
         <value>5</value>
       </parameter>
       <parameter>
         <name>username</name>
         <value>xxxx</value>
       </parameter>
     </ResourceParams>
</Context>

----

Could someone please explain to me just how this is using DBCP?

Thanks!!
-- 
Lynn Hollerman.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: question

Posted by Parsons Technical Services <pa...@earthlink.net>.
What you have here is a classic case of cut and paste by the clueless(public 
boolean newbie;).

This code is from the server.xml that was setup for a Global database 
connection pool as opposed to a pool just for the app. The person has cut 
and pasted it into the context file for the app which will work but the pool 
is only available to that app. The first ResourceParams is used for the 
authentication of users when using login like the manager and admin apps. If 
you only wanted this app to use this file and different apps to use 
different files you would put one in each contex xml pointing to the proper 
file. With some other changes.

So unless you are doing something special with your authentication this is 
not needed here (newbie =true;).

If you have some special setup and are using this file for just this app 
(newbie=false;)

I think it would be safe to remove the first part and you might think about 
moving the DBCP to a global one. But that of course depends on your setup 
and needs.

For more details:
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources-howto.html
and look at the bottom two examples.

As for the factory see:

http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/context.html#Resource%20Parameters

It depends on the factory as to whether you need to declare it or not.

Doug

----- Original Message ----- 
From: "Hollerman Geralyn M" <gm...@louisiana.edu>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Friday, January 14, 2005 5:29 PM
Subject: <Context> question


>I was recently given a new application to maitain. It uses Tomcat 5.0.16 
>and an Oracle database. I have used various versions of Tomcat to work with 
>applications on two other kinds of databases, one of which uses DBCP, so I 
>am somewhat familiar with the needed parameters and went to the Tomcat JNDI 
>HOW-TO and the Tomcat Configuration Reference to refresh my memory on just 
>what this was doing, but I have to admit I don't completely understand 
>this - what I have included is the <Context>.xml file for the "new" 
>application. What I don't understand is that first <ResourceParams> set of 
>statements - it appears to be saying to look at the "database" of users in 
>the tomcat-users.xml file in /conf - but why? That file hasn't been altered 
>to contain anything but the defaults, and the person that gave me the "new" 
>app was the one that set up Tomcat for it, so I assume its set up as 
>needed! Also, why is there no factory in the 2nd <ResourceParams> in this 
>file? I thought one was needed. The person that gave me this said DBCP was 
>implemented, but I don't see how this would do it.
> ----
> <Context docBase="graduate" path="/graduate">
>   <Resource auth="Container" name="jdbc/ConnectionPool" 
> type="javax.sql.DataSour
> ce"/>
>    <ResourceParams name="UserDatabase">
>       <parameter>
>         <name>factory</name>
>         <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
>       </parameter>
>       <parameter>
>         <name>pathname</name>
>         <value>conf/tomcat-users.xml</value>
>       </parameter>
>     </ResourceParams>
>     <ResourceParams name="jdbc/ConnectionPool">
>       <parameter>
>         <name>maxWait</name>
>         <value>5000</value>
>       </parameter>
>       <parameter>
>         <name>maxActive</name>
>         <value>100</value>
>       </parameter>
>       <parameter>
>         <name>password</name>
>         <value>xxxx</value>
>       </parameter>
>       <parameter>
>         <name>url</name>
>         <value>jdbc:oracle:thin:@xxxx</value>
>       </parameter>
>       <parameter>
>         <name>driverClassName</name>
>         <value>oracle.jdbc.driver.OracleDriver</value>
>       </parameter>
>       <parameter>
>         <name>maxIdle</name>
>         <value>5</value>
>       </parameter>
>       <parameter>
>         <name>username</name>
>         <value>xxxx</value>
>       </parameter>
>     </ResourceParams>
> </Context>
>
> ----
>
> Could someone please explain to me just how this is using DBCP?
>
> Thanks!!
> -- 
> Lynn Hollerman.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org