This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara 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


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to write database agnostic/independent code in Java ?