Your web-application does not keep a track of how many databases you are connecting to. You can change the URL and database name in the getConnection() method and connect to as many dtabases as you want.
RAGHU<br /> <br />"When the going gets tough, the tough get going"
Joined: Nov 21, 2006
thanks for your reply Raghu. But i want to know whether one web application can connect to multiple databases simulteniously. If yes then please tell me how.
Joined: Jan 05, 2007
You can write different methods which establish connection to different databases and return a connection object. Using Javabeans would be convenient here. You can call these methods as per your needs. But do close the statements and connections after each call.
You can of course connect to different databases, just use different Connection objects for each connection that you establish.
As rightly said above use JTA, to manage your transaction. Best designs in real-time enterprise applications would of course stay clear of complicating matters with using single transactions for multiple databases.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Can one Web Application connect to multiple databases