File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Connection Pooling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Connection Pooling" Watch "Connection Pooling" New topic

Connection Pooling

Glenny Dsilva
Ranch Hand

Joined: May 09, 2005
Posts: 42
I have tried connection pooling according to the documentation given
in tomcat 5.0.18, its working fine.

But in my project I need to connect to 2 databases from one context.
According to a given parameter can i connect to a particular
database using a connection pool.
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Different database == different DataSource (and therefore a differernt connection pool). So long as you have two DataSources configured it should be trivial to swap between the two.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
You can go for two seperate pools.
Glenny Dsilva
Ranch Hand

Joined: May 09, 2005
Posts: 42
Thanks a lot its working fine now

One more doubt I wanna clear is that on mysql server i get the process list

as given below

Id UserHostdbCommand Time

142root localhost:1531javatestSleep10

I cannot understand why do i get the above process list i.e. in Sleep mode

Is it okay or what is the procedure to kill the process or close the connection

I have closed the connection in the class file using con.close()

I have also added the abandoned db connection in the xml code i.e. below

I agree. Here's the link:
subject: Connection Pooling
It's not a secret anymore!