aspose file tools*
The moose likes JDBC and the fly likes Connection Pooling - is JNDI the only way? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connection Pooling - is JNDI the only way?" Watch "Connection Pooling - is JNDI the only way?" New topic
Author

Connection Pooling - is JNDI the only way?

Felix Kan
Greenhorn

Joined: Aug 12, 2002
Posts: 8
I've read a lot of articles and guides in JDBC connection pooling, and all of them involve the use of JNDI lookup to retrieve a DataSource.
I'm wondering if it is required to use JDNI in order to create a pooled connection? Or I can simply instantiate the driver class as follows:


The reason why I'm looking into alternatives that doesn't involve JNDI is due to a bug between WAS and the Oracle driver. I am unable to register OracleConnectionPoolDataSource into the WAS JNDI context correcty (the datasource got registered into the context but returned as "com.ibm.ejs.cm.JDBC1PhaseRF", a class that cannot be casted into sql.javax.DataSource).
[ August 12, 2002: Message edited by: Felix Kan ]
Rudy Dakota
Ranch Hand

Joined: Jul 27, 2002
Posts: 54
Hi there Felix,
Your proposed approach will work just fine! At least, I have been working like that for about a year now without problems.
On the other hand: if I were you I 'd try and get around the configuration issues. Creating the data source from scratch is just an ugly workaround, after all.
Good riding,
Rudy.
Felix Kan
Greenhorn

Joined: Aug 12, 2002
Posts: 8
Rudy,
Yahoo! Thanks a lot for your quick reply! This is my first post on javaranch
The ClassCastException problem between WSAD (WebSphere Studio Application Developer... an Eclipse-based product) and Oracle still remains to be a mystery. I've spotted a few threads on the Websphere thread and there isn't a clear solution to it.
Yeah it's really bad to have all these ds settings hard-coded into the source code, but at least for now I can settle with the help of Ant build files.
Cheers,
Felix
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Connection Pooling - is JNDI the only way?