aspose file tools
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 Head First Android this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "connection pooling" Watch "connection pooling" New topic
Author

connection pooling

Vijayalakshmi Karthikeyan
Greenhorn

Joined: Jul 23, 2010
Posts: 27
Hi all,
Can we create a connection pooling for multiple database. If possible Can you please guide me with sample code..
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2541
    
  10

Yes, this is possible. You can create a connection pool for each of your databases.
When you need a connection for a particular database, you ask one from the corresponding pool.
When you later close that connection, it will be automatically given back to the right pool.


OCUP UML fundamental and ITIL foundation
Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 622
1st you need to configure Tomcat 5.5 with admin console. After configuring that Create a helper class. Use JNDI to look up the connection. Create a static method to get connection(the return type for which is Connection)

I am providing you some part of the code


Whenever you want to create a connection( logical connection), just call Classname.getConnection. (in my case DbUtil.getConnection)


kunal
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: connection pooling
 
jQuery in Action, 3rd edition