This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Connecting to two different dbs in the same application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Connecting to two different dbs in the same application" Watch "Connecting to two different dbs in the same application" New topic
Author

Connecting to two different dbs in the same application

Kjetil Nilsen
Greenhorn

Joined: Jan 26, 2005
Posts: 5
Hello.

I have a problem concerning connections to a database. I have an application that connects to a postgresql db, retrieves inforamtion which is processed an than used in a query to an oracle db, but when I try to connect to this db I get an SQLException saying that my oracle table isn't in my postgresql base. I have two different databaseaccess classes to handle the different connections, but still I get the same error.

So my question is; is it possible to connect to two different dbs in the same application and if so how?

I hope this wasn't to unclear.
Thanks!!

Kjetil


---------------------------------<br />Kjetil
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


So my question is; is it possible to connect to two different dbs in the same application and if so how?

Yes. Just uses two connections - one for each DB.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Kjetil Nilsen
Greenhorn

Joined: Jan 26, 2005
Posts: 5
Thanks for your answer Paul.

I had allerady found a solution. I made a new object which held a static variable to a connection manager. I had forgotten that.

But anyway thanks!

Kjetil
 
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: Connecting to two different dbs in the same application
 
It's not a secret anymore!