Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

connection pooling

 
Vijayalakshmi Karthikeyan
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Can we create a connection pooling for multiple database. If possible Can you please guide me with sample code..
 
Jan Cumps
Bartender
Posts: 2602
13
C++ Linux Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic