This week's book giveaway is in the Flex forum.
We're giving away four copies of Flex 4 in Action and have Tariq Ahmed, Dan Orlando, John C. Bland II & Joel Hooks on-line!
See this thread for details.
[Logo] JavaRanch » JavaRanch Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Win a copy of Flex 4 in Action this week in the Flex forum!
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » JDBC
 
RSS feed
 
New topic
Author

Connecting to multiple DataBase

v chenna
Greenhorn

Joined: Dec 28, 2009
Messages: 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
Bartender

Joined: Sep 29, 2008
Messages: 6852

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.

Consultant/Trainer | Polyglottal Developer | Struts Committer/PMC | Struts 2 Web Application Development
v chenna
Greenhorn

Joined: Dec 28, 2009
Messages: 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
Messages: 8

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

Joined: Sep 29, 2008
Messages: 6852

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.

Consultant/Trainer | Polyglottal Developer | Struts Committer/PMC | Struts 2 Web Application Development
Deepak Bala
Bartender

Joined: Feb 24, 2006
Messages: 4868

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
Bartender

Joined: Aug 26, 2006
Messages: 4601

V. Chenna, please do not crosspost:

Crosspost of this Question




Author of Hibernate Made Easy, What is WebSphere???, Portlet Programming Made Easy and the SCJA Certification Guides
My Hibernate and JPA Tutorials * My Mock Java Certification Exams * My Online Java Tutorials * My CBT Portlet Tutorials.

 
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » JDBC
 
RSS feed
 
New topic
The most intelligent Java IDE