• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need Advice on Flexible Database integration with app

 
Mamu Jan
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34863
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depending on what you are planning to do, you might also want to consider using a OR-mapping tool, such as hibernate.
 
Prabhu Venkatachalam
Ranch Hand
Posts: 502
Java jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Hung Tang
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic