design for using different dbs 
Author Message
 design for using different dbs

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



Sat, 31 Dec 2005 19:37:46 GMT
 design for using different dbs

On Tue, 15 Jul 2003 7:37:46 -0400, j wrote

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



Sun, 01 Jan 2006 07:39:42 GMT
 design for using different dbs
I've written a little white paper on how this can be achieved.

http://www.asg.sc.edu/pdf/DatabaseIndependence.pdf

Good luck!

Quote:

> 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



Sun, 01 Jan 2006 09:37:14 GMT
 design for using different dbs

Quote:

> I've written a little white paper on how this can be achieved.

> http://www.asg.sc.edu/pdf/DatabaseIndependence.pdf

Thanks Ed for the pointer. you've provided some great tips but
unfortunatly I don't see how they anser my question.

I have a app that I want to point to Oracle today and Sybasee Tomorrow.

Both dbs have a stored proc named GetClientList which returns a result
set to the client. The way the Oracle does it and the way Sybase does it
are totaly differrent in how they pass back the result set so that you
can't just change JDBC drivers. Someplace in the app I have to write
database specific, Oracle, Sybase whatever, code for methods with the
same name that return the same ResultSet. It's only a couple of lines of
code different but it still means that any db accessor that that calls
an SP that returns a Result set needs to be database specific.

My question is what is the best way to, or more probably what are the
trades offs in the different ways, to do this?

jw



Sun, 01 Jan 2006 19:27:56 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. Mapping different DBs to a single DB

2. Dimensions from 2 Different DBs

3. access data from two different dbs

4. Join query with tables from _separate_ DBs on different SQL Servers

5. Stored Proc permission different in 2 DBs

6. Info from 2 different DBs

7. Join 2 tables from 2 different DBs

8. Refrencing Tables In Different DBs

9. Performance Bug? Timing different on identical DBs

10. Joining tables from different DBs

11. Trans. replication delete different DBs

12. Backup DBs from job on a different server


 
Powered by phpBB® Forum Software