commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <dirk.verbe...@pandora.be>
Subject Re: Getting DBCP working through Tomcat 4.1
Date Thu, 20 Jan 2005 18:18:54 GMT
Hi Mike

You need a DriverAdapterCPDS and a PerUserPoolDataSource.
Try the following configuration:

<Resource name="jdbc/TestDBCPDS" auth="Container" 
type="org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS"/>
<ResourceParams name="jdbc/TestDBCPDS">
<parameter><name>factory</name><value>org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS</value></parameter>
<parameter><name>user</name><value>sa</value></parameter>
<parameter><name>password</name><value></value></parameter>
<parameter><name>driver</name><value>com.sybase.jdbc2.jdbc.SybDrivers</value></parameter>
<parameter><name>url</name><value>jdbc:sybase:Tds:<myServerName>:<myPort>?charset=iso_1</value></parameter>
</ResourceParams>

<Resource auth="Container" name="jdbc/TestDB" 
type="org.apache.commons.dbcp.datasources.PerUserPoolDataSource"/>
<ResourceParams name="jdbc/TestDB">
<parameter><name>factory</name><value>org.apache.commons.dbcp.datasources.PerUserPoolDataSourceFactory</value></parameter>
<parameter><name>defaultMaxActive</name><value>10</value></parameter>
<parameter><name>defaultMaxIdle</name><value>2</value></parameter>
<parameter><name>defaultMaxWait</name><value>-1</value></parameter>
<parameter><name>dataSourceName</name><value>java:comp/env/jdbc/TestDBCPDS</value></parameter>
</ResourceParams>

-- Dirk

mike.raath@barclayscapital.com wrote:
> Hello all, and apologies if I am asking a question which has been asked
> before (I presume it has but I can't find anything after comprehensive
> searching).
> 
> I am trying to get a simple Tomcat application up using DBCP, and got
> BasicDataSource working fine. However, our applications all run under
> their own identities, and therefore need to be able to get connections
> based on username. I have tried using PerUserPoolDataSource and
> SharedPoolDataSource with no luck. The exception I am currently getting
> is as follows:
> "Must set the ConnectionPoolDataSource through setDataSourceName or
> setConnectionPoolDataSource before calling getConnection"
> 
> My configuration is as follows:
> Tomcat 4.1.24, DBCP 1.2.1, Sybase jConnect 5.0 build 10229 (Sybase and
> DBCP jars in <tomcat_base>/common/lib)
> 
> Following is an extract of my configuration files, and application code.
> I would greatly appreciate some help - this is beginning to drive me
> insane!
> 
> Thanks in advance,
> Mike


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


Mime
View raw message