Home » Server Options » Text & interMedia » Accessing Database of Oracle using thin driver of JDBC
Accessing Database of Oracle using thin driver of JDBC [message #76116] Wed, 01 September 2004 21:51 Go to next message
Qamar Abbas
Messages: 2
Registered: July 2004
Junior Member
I am working on JSP a proble is exiting in my code the connection with database using thin driver is not establishing. My JDBC code is given as:
import oracle.jdbc.driver.*;
import java.sql.*;
class dbAccess {
public static void main (String args [[]]) throws SQLException
{
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());

Connection conn = DriverManager.getConnection
("jdbc:oracle:thin:@soft:1526:oracle", "scott", "tiger");
// soft=machineName:1526=port:oracle=SID,userid, ssword

Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select ename from emp");
while (rset.next())
System.out.println (rset.getString(1));
//Print col 1
stmt.close();
}
}

I have established the classpth of classes111.zip where the Class file of OracleDriver is placed.
Please send me the correct code of this situation.
Thanks
Qamar Abbas
Re: Accessing Database of Oracle using thin driver of JDBC [message #76161 is a reply to message #76116] Mon, 13 December 2004 21:13 Go to previous message
saroj
Messages: 3
Registered: July 2002
Junior Member
Dear Abbas,

There is possibility for yor problem for following reason...

Oracle version.
There are different jar file for different version of oracle. For Oracle 8.1.7, it will work. If you are working with Oracle 9.2, then u have to put OJDBC14.jar. You have to put proper Jar file according to your oracle version.

File Extension.
You can try another option to solve this. You have to rename classes111.zip to classes111.jar file.

If your are using Oracle 8.1.7/9.0 then second option will work. If it doesnot work revert me.

Regards

saroj
Previous Topic: how to spool csv?
Next Topic: table with sequnce
Goto Forum:
  


Current Time: Thu Mar 28 10:58:09 CDT 2024