aspose file tools*
The moose likes Servlets and the fly likes jdbc connections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "jdbc connections" Watch "jdbc connections" New topic
Author

jdbc connections

thinkofsatish
Greenhorn

Joined: Jun 05, 2006
Posts: 1
hi all,
in my application i need to deal with different databases. can u suggest me which is the best way .

regards,
satish
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

thinkofsatish
Welcome to JavaRanch!

We're pleased to have you here with us in the servlets forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

You can change it here


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3697
    
    5

Originally posted by satish kumar bairi:
hi all,
in my application i need to deal with different databases. can u suggest me which is the best way .

regards,
satish


Its nearly impossible to design a large-scale application that works indepentently of the database being used. Sure, there are ways to make database transitions less painful, but its rare to find a system that can completely switch back and forth between database types with optimal performance.

Some of those ways are... using standard JDBC drivers and don't use any database-dependent calls. I good example of this is trying to determine whether an insert statement generated any keys. Any JDBC-provided solution is often non-standard. You could also try an object oriented model like JDO/Hibernate, but then you may be spending a lot of time updating XML files instead of Java Code.

The real problem is that often times, to achieve realistic performance, you are forced to write direct SQL statements that are DBMS specific. One solution for this is to use a factory pattern. For example, have a DAO interface and implement that interface for a specific database type. This is generally a very good solution although it means anytime you want to add a new database to the mix, you have to re-implement a new set of DAOs (which can be very time consuming).
[ June 05, 2006: Message edited by: Scott Selikoff ]

My Blog: Down Home Country Coding with Scott Selikoff
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jdbc connections