I'd like to get some ideas on best object design for using multiple dbs
e.e. Oracle and Sybase. In the past I've only done some re-writing of
apps to point at either DB and just did some and then use a case
statement, looked at the JDBC driver class name. If it had the word
Sybase in it I did one thing and if it had Oracle in it I did another.
When I start the app I use parameters which tell it the URL for the DB
and which driver to use.
I could use one DB object for each database but I think that would get
unweildy with at lesat 2 methods for each object with whose data is
inthe db, e.g. customer, invoice, line item.
I could write one object for each database so I'd have a sybaseCustomer,
oracleCutomer etc.
Then were do you make the decision? Do I use and object factory that
knows about which of the two to use?
ObjectFActory.getObject("Customer");
Just looking for advice fromthose that have been down the road before.
Thank
jw
J - 16 Jul 2003 00:39 GMT
IWith my web app, I use Hibernate for all my database/object mapping. So
when I need to use a different database, I change the properties file for
Hibernate. Then the system will use the correct database.
Makes writing db objects so easy, and makes the switching between dbs a
little easier.
J
Ed Yu - 16 Jul 2003 02:37 GMT
I've written a little white paper on how this can be achieved.
http://www.asg.sc.edu/pdf/DatabaseIndependence.pdf
Good luck!
> I'd like to get some ideas on best object design for using multiple dbs
> e.e. Oracle and Sybase. In the past I've only done some re-writing of
[quoted text clipped - 21 lines]
> Thank
> jw