You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by pq...@shareowner.com on 2002/12/18 17:33:51 UTC

tomcat jndi + commons-dbcp problem

Tomcat's JNDI simulation uses commons-dbcp.
 
I have several questions to ask.
 
- Can I get an oracle Connection from data source if I use oracle's jdbc
driver?
- "Are all those DBCP classes, such as BasicDataSource, or
PoolableConnection not castable?" I can't cast BasicDataSource to
java.sql.DataSource, for example.
 
 
Regards,
 
 
 
Phillip Qin
 
"This Guy Thinks He Knows Everything"
Canadian Shareowner
121 Richmond Street W, 7th Floor
Toronto, ON M5H 2K1
(416) 595-9600 ext 291
 

Re: tomcat jndi + commons-dbcp problem

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Wed, 18 Dec 2002 pqin@shareowner.com wrote:

> Date: Wed, 18 Dec 2002 11:33:51 -0500
> From: pqin@shareowner.com
> Reply-To: Jakarta Commons Users List <co...@jakarta.apache.org>
> To: commons-user@jakarta.apache.org
> Subject: tomcat jndi + commons-dbcp problem
>

These questions are actually appropriate on the TOMCAT-USER list, but what
the heck ...

> Tomcat's JNDI simulation uses commons-dbcp.
>
> I have several questions to ask.
>
> - Can I get an oracle Connection from data source if I use oracle's jdbc
> driver?

Yes.  For Tomcat 4.1, there's example setups for this in the docs shipped
with Tomcat, or online:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html

> - "Are all those DBCP classes, such as BasicDataSource, or
> PoolableConnection not castable?" I can't cast BasicDataSource to
> java.sql.DataSource, for example.

There's no such thing as "java.sql.DataSource", but there is
"javax.sql.DataSource" -- and that is the correct interface to cast to.
It works as long as you don't mess around with the class loader hierarchy
by trying to put jdbc2_0-stdext.jar somewhere it doesn't belong.

>
>
> Regards,
>
>
>
> Phillip Qin

Craig McClanahan