aspose file tools*
The moose likes JDBC and the fly likes types of drivers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "types of drivers" Watch "types of drivers" New topic
Author

types of drivers

venkat
Greenhorn

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

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
Greenhorn

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

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

type1

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 :

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




to connect to the specific database.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: types of drivers