Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes JDBC and Relational Databases and the fly likes types of drivers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "types of drivers" Watch "types of drivers" New topic

types of drivers


Joined: Jan 23, 2000
Posts: 10
please send the connection code for all 4 drivers.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Connection code is always the same regardless of Driver version, vendor and type, that's the point.

Please see the warning on your display name here, your account is about to be deleted.
ganesh narayana

Joined: Sep 10, 2005
Posts: 7
Dear Friend,

only the driver and URL differes from one type to second type.


driver : sun.jdbc.odbc.JdbcOdbcDriver
url : jdbc dbc:<<dsn name>>

type 2 for oracle

driver : oracle.jdbc.driver.OracleDriver
url : jdbc racle ci8:@

type 4 for oracle

driver : oracle.jdbc.driver.OracleDriver
url : jdbc racle:thin:@localhost:1521:<<oracle SID>>

then use Class.forName(driver name)
Connection con=DriverManager.getConnection(url,username,password)

for example :

Connection con=DriverManager.getConnection("jdbc racle:thin:@localhost:1521:<<oracle SID>>","scott","tiger");

to connect to the specific database.
I agree. Here's the link:
subject: types of drivers
It's not a secret anymore!