wood burning stoves 2.0*
The moose likes JDBC and the fly likes Database Abstract Factory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Database Abstract Factory" Watch "Database Abstract Factory" New topic
Author

Database Abstract Factory

Mark Herschberg
Sheriff

Joined: Dec 04, 2000
Posts: 6037
We want our product to support multiple databases, but there are some issues. For example, different database vendors tend to store dates differently. We would want to make our core code as database independent as possible. I'm thinking we need some type of database abstract factory. I realize JDBC does this to some extent, but from what I know, it seems to be only for driver-related issues.
Can someone point me to any solution, paper, article, web site, etc which addresses this issue. I'm sure it's a fairly common problem, and has been solved by people more knowledgeable than us.
Thank you.

--Mark
hershey@vaultus.com
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Use the java.sql.Date object.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Mark Herschberg
Sheriff

Joined: Dec 04, 2000
Posts: 6037
Originally posted by Thomas Paul:
Use the java.sql.Date object.

java.sql.Date only goes down to seconds, we need miliseconds. Moreover, asking the database itself (as opposed to our program) for the time requires a different command for different vendors. Asking db's for sequences have a similar issue.
Any thoughts?

--Mark
hershey@vaultus.com
Peter Tran
Bartender

Joined: Jan 02, 2001
Posts: 783
Thomas,
This won't work for SQL*Server if you're using the Merant drivers. I'm not sure with other driver implementation, but Merant says SQL*Server doesn't support the java.sql.Date object, because there is not date type in SQL*Server. You would have to use java.sql.Timestamp. What a royal pain-in-the-ass! I thought JDBC would sheild me away from being platform dependent, but now I still have to maintain two code base. Once that uses java.sql.Date for ORACLE and java.sql.Timestamp for SQL*Server.
-Peter
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Carved over the entrance to hell: "Abandon all hope ye who use Microsoft products."
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Database Abstract Factory
 
Similar Threads
Pattern used in the qn
Exactly what kind of pattern is this?
why favor interface?
Dquestions about design patterns
Settling out which factory pattern EJBHome uses