Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

programming with all JDBC Drivers

 
siva raman
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic