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.
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.
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
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.
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.
subject: Need Advice on Flexible Database integration with app