Your conections are pooled by Tomcat.

I don't know how you configure your Resource, mine looks like this

  <Resource name="jdbc/whatever" auth="Container" scope="Shareable"
type="javax.sql.DataSource" /> 
- <ResourceParams name="jdbc/whatever">
- <parameter>
  <name>driverClassName</name> 
  <value>oracle.jdbc.driver.OracleDriver</value> 
  </parameter>
- <parameter>
  <name>url</name> 
  <value>jdbc:oracle:thin:@myhost.com:1521:mysid</value> 
  </parameter>
- <parameter>
  <name>username</name> 
  <value>myuser</value> 
  </parameter>
- <parameter>
  <name>password</name> 
  <value>mypass</value> 
  </parameter>
- <parameter>
  <name>maxActive</name> 
  <value>25</value> 
  </parameter>
- <parameter>
  <name>maxIdle</name> 
  <value>5</value> 
  </parameter>
- <parameter>
  <name>minIdle</name> 
  <value>5</value> 
  </parameter>
- <parameter>
  <name>maxWait</name> 
  <value>15000</value> 
  </parameter>
- <parameter>
  <name>removeAbandoned</name> 
  <value>true</value> 
  </parameter>
- <parameter>
  <name>validationQuery</name> 
  <value>SELECT SYSDATE FROM DUAL</value> 
  </parameter>
- <parameter>
  <name>testOnBorrow</name> 
  <value>true</value> 
  </parameter>
- <parameter>
  <name>testOnReturn</name> 
  <value>true</value> 
  </parameter>
- <parameter>
  <name>minEvictableIdleTimeMillis</name> 
  <value>-1</value> 
  </parameter>
- <parameter>
  <name>timeBetweenEvictionRunsMillis</name> 
  <value>30000</value> 
  </parameter>
- <parameter>
  <name>numTestsPerEvictionRun</name> 
  <value>1</value> 
  </parameter>
- <parameter>
  <name>testWhileIdle</name> 
  <value>true</value> 
  </parameter>

To test if pooling works, you either observe the number of jdbc connections
in oracle or do a netstat to list of jdbc connections (not 1521). In my
case, max idle would be 5.

-----Original Message-----
From: David Uctaa [mailto:[EMAIL PROTECTED] 
Sent: December 21, 2004 4:30 PM
To: Tomcat Users List
Subject: Re: Difficulty connecting to DB2 for iSeries from Tomcat 5.0.28


Looks like that worked! Many thanks!  :)

Now my question is, since I'm using javax.sql.DataSource as the
ResourceType, how do I know if I'm using the connection pool or opening a
new connection each time I request a connection?

The factory associated with the resource is
org.apache.commons.dbcp.BasicDataSourceFactory

Does this factory provide connection pooling?  If not, how do I change the
implementation to use pooling?  Once I'm using pooling, how do I find out
how many connections are in use?  How do I find out if a connetion I am
about to get will come from the pool or if a new connection is being
created?  Etc.  Is there a page somewhere that references this information?

Thanks again.


On Tue, 21 Dec 2004 16:03:42 -0500, Phillip Qin <[EMAIL PROTECTED]>
wrote:
> Can you try javax.sql.DataSource in <Resoure>? You use 
> javax.sql.DataSource in resourcelink then the type in resource has to 
> be the same.
> 
> -----Original Message-----
> From: David Uctaa [mailto:[EMAIL PROTECTED]
> Sent: December 21, 2004 3:26 PM
> To: Tomcat Users List
> Subject: Re: Difficulty connecting to DB2 for iSeries from Tomcat 
> 5.0.28
> 
> <Resource 
> type="com.ibm.as400.access.AS400JDBCConnectionPoolDataSource"
> auth="Container" scope="Shareable" name="jdbc/MYDATASOURCE"/>
> 
> On Tue, 21 Dec 2004 15:02:58 -0500, Phillip Qin 
> <[EMAIL PROTECTED]>
> wrote:
> > I assume you have something like this in your server.xml
> >
> > <Resource name="jdbc/MYDATASOURCE" auth="Container" 
> > scope="Shareable" type="javax.sql.DataSource" />
> >
> > Is there any warning or exception in catalina.out or any other log 
> > files?
> >
> > -----Original Message-----
> > From: David Uctaa [mailto:[EMAIL PROTECTED]
> > Sent: December 21, 2004 1:52 PM
> > To: Tomcat Users List
> > Subject: Re: Difficulty connecting to DB2 for iSeries from Tomcat 
> > 5.0.28
> >
> > If the name of the global resource in server.xml is defined as 
> > <GlobalNamingResources>
> >    <Resource [attribs] name="jdbc/MYDATASOURCE"/>
> >    <ResourceParams name="jdbc/MYDATASOURCE">
> >          <param>...</param>
> >    </ResourceParams>
> > </GlobalNamingResources>
> >
> > then the resourcelink in context.xml is
> >
> > <Context [attribs]>
> >     <ResourceLink
> >             global="jdbc/MYDATASOURCE"
> >             name="jdbc/MYDATASOURCE"
> >             type="javax.sql.DataSource"/>
> > </Context>
> >
> > (not sure if listing the exact datasource specification would be a 
> > security breach, so I'm munging the actual datasource name, but 
> > everything else is the same, including upper/lower case)
> >
> > On Tue, 21 Dec 2004 13:39:07 -0500, Phillip Qin 
> > <[EMAIL PROTECTED]>
> > wrote:
> > > What is the resourcelink in your context.xml?
> > >
> > >
> > > -----Original Message-----
> > > From: David Uctaa [mailto:[EMAIL PROTECTED]
> > > Sent: December 21, 2004 12:27 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: Difficulty connecting to DB2 for iSeries from Tomcat 
> > > 5.0.28
> > >
> > > No matter what i do, the JNDI lookup is returning null.  What 
> > > causes a JNDI lookup to return null when the resource is defined 
> > > in the <GlobalNamingResources> section of server.xml?  Should I 
> > > put the resources into <NamingResources> in my context.xml?
> > >
> > > On Mon, 20 Dec 2004 13:52:29 -0500, David Uctaa <[EMAIL PROTECTED]>
> > > wrote:
> > > > I am running Tomcat 5.0.28 on Win XP SP1.  We have DB2 running 
> > > > on 2 iSeries servers.  When I attempt to look up a DataSource 
> > > > from JNDI to get a connection from it, the JNDI lookup is 
> > > > returning null.
> > > >
> > > > I am using IBM's JTOpen library for the JDBC drivers, and I am 
> > > > attempting to use Tomcat to manage the connection pooling.  I am 
> > > > following the instructions I saw listed here:
> > > > http://www.itjungle.com/fhg/fhg060204-story01.html .   I am trying
the
> > > > first option, using the Commons DBCP connection pool.
> > > >
> > > > I have attached copies of my server.xml and the context 
> > > > configuration file webappname.xml.  The code I am using to 
> > > > access the data source is pretty generic:
> > > >
> > > > Context initCtx = new InitialContext();
> > > > Context ctx = (Context) initCtx.lookup("java:comp/env"); 
> > > > DataSource ds = (DataSource) 
> > > > ctx.lookup("jdbc/myFirstDataSource");
> > > > Connection conn = ds.getConnection();
> > > >
> > > > It turns out the that ctx.lookup call is returning null, as if 
> > > > it can't find the JNDI resource, and I can't figure out what I 
> > > > have misconfigured.
> > > >
> > > > Any and all help will be greatly appreciated.
> > > >
> > > >
> > > >
> > >
> > > ------------------------------------------------------------------
> > > --
> > > -
> > > 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]
> >
> >
> >
> >
> >
> 
> ---------------------------------------------------------------------
> 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]


!DSPAM:41c895f5322192521778996!

Reply via email to