Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connection Pooling - is JNDI the only way?

 
Felix Kan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic