IntelliJ Java IDE
The moose likes JDBC and the fly likes Connecting to multiple DataBase Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JDBC
Reply Bookmark "Connecting to multiple DataBase" Watch "Connecting to multiple DataBase" New topic
Author

Connecting to multiple DataBase

v chenna
Greenhorn

Joined: Dec 28, 2009
Posts: 11
I am developing struts application which it has to support to connect multiple databases with out changing the code.

For example, client has his own choice to select a data base(Oracle,SQL Server,My SQL...) code has to support.

please provide the code or any link or clue for this

bye.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12612
This doesn't really have anything to do with Struts, but with how you're accessing the database in the first place.

Unless you're using an ORM, you're going to have issues.
v chenna
Greenhorn

Joined: Dec 28, 2009
Posts: 11
Without using DAO or ORM tools is it possible. like can we go using Resource Properties file
Ernesto Chicas
Greenhorn

Joined: Jan 13, 2010
Posts: 18

I do not know if you've considered the possibility of using and combining spring with hibernate to use multiple datasource
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12612
How are you doing your queries? Do you need to generate new database rows that would need a unique ID? How would you overcome SQL differences?

I'm moving this to JDBC.
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6371

How would you overcome SQL differences?


Yep. That is an important question - that.

Depending on whether you are dealing with the same tables / queries the answers vary.


SCJP 6 articles - SCJP 5/6 mock exams - SCJP Mocks - SCJP 5 Mock exam (Word document ) - SCJP 5 Mock exam in Java.Inquisition format
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4962

V. Chenna, please do not crosspost:

Crosspost of this Question




Author of Hibernate Made Easy, What is WebSphere???, JSF 2.0 Made Easy and the SCJA Certification Guides
 
IntelliJ Java IDE
 
subject: Connecting to multiple DataBase
 
Threads others viewed
How to connect multiple databases at a time using Hibernate
Connecting to multiple DataBase
jdbc batch
compare java with others
Effective Java
developer file tools