my dog learned polymorphism*
The moose likes JDBC and the fly likes programming with all JDBC Drivers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "programming with all JDBC Drivers" Watch "programming with all JDBC Drivers" New topic
Author

programming with all JDBC Drivers

siva raman
Greenhorn

Joined: Sep 15, 2003
Posts: 5
Hai programmers,
I would like to make database access using all 4 types of Java Drivers.
I normally use JDBCODBC Driver or vendor specific driver like OracleDriver.
But didn't even tried or know how to use Type2, Type3,Type4 drivers.
pl help me by giving the codes
thanking you,
L.sivaraman.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

The whole point is that the code should be the same. The code to access the database and the database type should be independant. This is no longer true if you use database specific SQL, so try not to do that.
You only need to change two things and the rest should stay the same. Change the Class.forName() line to refer to the new Driver, and change the database URL to refer to the new Driver.
Dave.
 
 
subject: programming with all JDBC Drivers
 
Similar Threads
opinion soughted
Does JDBC works on all ODBC
Order in bind variable for PreparedStatement in Java
Facing Big Problem with Sql Server 2000 Odbc Driver
Oracle Driver for WebSphere