This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes How to write database agnostic/independent code in Java ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to write database agnostic/independent code in Java ?" Watch "How to write database agnostic/independent code in Java ?" New topic
Author

How to write database agnostic/independent code in Java ?

David Jason
Greenhorn

Joined: Aug 21, 2012
Posts: 27
Each database has its own characteristics and the same SQL statements will not necessarily work on all of them.
In that case, it it seems better to write code for each database instead of one big class that can handle all databases.
Is it possible to make your code database agnostic ? If so, how can we do that ?

Dielson Sales
Greenhorn

Joined: Feb 02, 2011
Posts: 4

David Jason wrote:Is it possible to make your code database agnostic ? If so, how can we do that ?


You can take a look at Hibernate (Java). It can generate the SQL queries depending on the driver used, hence making your code portable to any supported SQL database.
 
Have you checked out Aspose?
 
subject: How to write database agnostic/independent code in Java ?
 
It's not a secret anymore!