File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 Spring in Action this week in the Spring 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 ?