You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Dhananjay Makwana <ma...@semandex.net> on 2006/09/20 22:46:05 UTC

[dbcp] Problem getting Connection with multiple JDBC drivers

Hi All, 

I have a component that uses commons-dbcp for JDBC connection pooling while
talking to multiple databases. The component runs in "home-grown"
application server. Each application in the server may talk to a particular
database (oracle or SQL Server). I have two separate JDBC drivers (say A and
B) on the classpath of app-server. Thus, I can run different apps talking to
oracle (using driver A) and SQL Server (using driver B). 

I am using BasicDataSource class to create connection. The problem is that
driver B has a bug where for Driver.acceptsURL() method it throws a NPE. Now
when I call BasicDataSource.getConnection() it calls above method for driver
B and fails. So my question is that, in commons-dbcp, can I do something as
a workaround? 

Even though I am creating BasicDataSource and providing "driver class",
"JDBC URL", "user name" and "password", I am guessing it scans the classpath
to create the Driver. I tried setting "jdbc.drivers" property to just driver
A but dbcp still scans for all drivers. 

Appreciate any help. 

Thanks,
-Jay


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