Author
Connecting to multiple DataBase
v chenna
Greenhorn
Joined: Dec 28, 2009
Messages: 11
posted Feb 09, 2010 10:32:26
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
posted Feb 09, 2010 10:50:32
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
posted Feb 09, 2010 11:34:49
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
posted Feb 09, 2010 15:37:44
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
posted Feb 09, 2010 16:35:09
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
posted Feb 09, 2010 21:00:28
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
posted Feb 10, 2010 07:40:24
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 .