On 12/07/2010 15:15, Ashish Kulkarni wrote:
> Hi
> Where do i specify data source factory? i have following setup
> 
> <Resource name="jdbc/mydev"
>    auth="Container"
>                  type="javax.sql.DataSource"
>                  maxActive="2" 
>                  maxIdle="2" 
>                  maxWait="3000"
>                  username="user" 
>                  password="password"
>                  driverClassName="com.ibm.as400.access.AS400JDBCDriver"
>                  url="jdbc:as400://myip;date format=iso;time
> format=iso;errors=basic;trace=false;"
>                   validationQuery="select * from   myschema.mytable" />

Is that the most lightweight validation query you can use?


You need to add the 'factory="..."' element.  It's default value is:

 'org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory'

N.B. the double dbcp.dbcp is intentional.
There's more documentation about configuring a DataSource here:

 
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html#Database_Connection_Pool_(DBCP)_Configurations

 http://wiki.apache.org/commons/DBCP


You will need to determine whether there is a suitable DataSource
factory class, in the com.ibm.as400.access package, or write your own
wrapper.  A quick Google search indicates someone else has done this
(AS400JDBCDataSourceFactory)


p


> On Fri, Jul 9, 2010 at 5:42 PM, Pid <p...@pidster.com
> <mailto:p...@pidster.com>> wrote:
> 
>     On 09/07/2010 20:03, Ashish Kulkarni wrote:
>     > Hi
>     > I have following in context.xml, and it works fine.
>     > But i would like to find how many active connections are there in data
>     > source or how many total connections are there?
>     > 1 is it possible to do so?
>     >
>     > 2 Can i change type javax.sql.DataSource
>     > to com.ibm.as400.access.AS400JDBCDataSource, as this has methods
>     to find
>     > active connections etc?
> 
>     Nope.
> 
>     If you use an appropriate DataSourceFactory that creates a
>     AS400JDBCDataSource then you can cast the DataSource that results from
>     the calls to JNDI to the one you want.
> 
>     Or you can use JMX to examine the running Tomcat.
> 
> 
>     p
> 
>     > <Resource name="jdbc/mydev"  auth="Container"
>     >  type="javax.sql.DataSource"
>     >                   maxActive="2"
>     >                   maxIdle="2"
>     >                   maxWait="3000"
>     >                   username="user"
>     >                   password="pass"
>     >                  
>     driverClassName="com.ibm.as400.access.AS400JDBCDriver"
>     >                   url="jdbc:as400://1mysystem;date format=iso;time
>     > format=iso;errors=basic;trace=false;"
>     >                   validationQuery="select * from   mytable" />
>     >
>     >
> 
> 
> 
> 
> 
> -- 
> Ashish
> www.ayurwellness.com <http://www.ayurwellness.com>
> www.mysoftwareneeds.com <http://www.mysoftwareneeds.com>


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to