Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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 Android Security Essentials Live Lessons this week in the Android 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 ?
 
Similar Threads
autogenerated keys
Hibernate made easy question - stored procs
what diaelect doing?
A question on Hibernate made easy
Problem in using java to Store 1GB+ files in a MySQL database