aspose file tools*
The moose likes Java in General and the fly likes Need Advice on Flexible Database integration with app Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Need Advice on Flexible Database integration with app" Watch "Need Advice on Flexible Database integration with app" New topic
Author

Need Advice on Flexible Database integration with app

Mamu Jan
Ranch Hand

Joined: Sep 21, 2005
Posts: 45
Hi,

I'm designing a software that needs a database. So, I need advice on how I can design my system so that it can adapt to any database be it MS Access or Oracle or MS SQL etc. What design patterns should I use? How about the Adapter Design pattern.

Thanks


There is no patch for ignorance...
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29241
    
139

Mamu,
I think the most important things are to use a DataSource and to write code that follows the SQL spec. The DataSource will allow you to change which database you are using in one place. The standard SQL will allow the JDBC code to run on most databases.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Depending on what you are planning to do, you might also want to consider using a OR-mapping tool, such as hibernate.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Prabhu Venkatachalam
Ranch Hand

Joined: Nov 16, 2005
Posts: 502

As previous poster said, if you are planning to use third party ORM tool, then you might consider Adapter pattern as well. This will help you change underlaying third party tool without modifying any thing in application.


Prabhu Venkatachalam<br />SCJP 1.4,SCWCD 1.4<br />prabhu.venkatachalam@gmail.com
Hung Tang
Ranch Hand

Joined: Feb 14, 2002
Posts: 148
If it's a simple application, just use JDBC. No need to complicate things and bring out an ORM. And you need to look into using DAO pattern, for shielding your application from data store changes, if applicable.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need Advice on Flexible Database integration with app
 
Similar Threads
type four driver(thin driver) for ms-access
Retrieve documetns from Oracle DB
Java JAR connecting to DB
Putting ResultSet into an Array list
jQuery and JSP