JDBC question [message #50123] |
Fri, 01 March 2002 10:28 |
Chen Wen
Messages: 26 Registered: February 2002
|
Junior Member |
|
|
How to connect to Oracle server by JDBC?
I tried by following codes, but failed.
1.
Driver driver =
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
DriverManager.registerDirver(driver);
Connection con =
DriverManager.getConnection("jdbc:oracle:oracle:@134.68.140.4:1521:orc
l","user","password");
2.
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con =
DriverManager.getConnection("jdbc:oracle:oracle:@134.68.140.4:1521:orc
l","user","password");
|
|
|
Re: JDBC question [message #50155 is a reply to message #50123] |
Mon, 04 March 2002 07:12 |
dug
Messages: 7 Registered: March 2002
|
Junior Member |
|
|
you need to register the oracle driver
the driver should be in classpath
(you can search the driver in your oracle_installationjdbclib directory which would normally be classes*.zip)
try this
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con =DriverManager.getConnection(url,username,password);
gracious
|
|
|