aspose file tools*
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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.
 
wood burning stoves
 
subject: How to write database agnostic/independent code in Java ?