Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

connecting 2 DBs in jsp

 
nitin ramachandran
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in a single jsp program, is it possible to connect to two databases (ie) to load two drivers at the same time in a single program? if yes how? please get me the answer...
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
moving to the jsp forum....

Eric
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65337
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving one more time... this is independent of whether the code is in a JSP or not so it's moving again to the JDBC forum.
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So have you tried it? If you are coding with Class.forName(.driver.class.) and DriverManager.getConnection(url), the driver manager will test different drivers to see which recognize the url, so it certainly is possible.

However, some things come to mind.
1. You mentioned JSP. In a web application, you should be using connection pools managed by your container. Servers easily maintain different connection pools to different databases.

2. You may have transactions that span multi-database operations. That would require support from your application container. Google for JTA.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic