aspose file tools*
The moose likes JDBC and the fly likes Problem with Oracle's JDBC/OCI driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem with Oracle Watch "Problem with Oracle New topic
Author

Problem with Oracle's JDBC/OCI driver

Wai Iu
Ranch Hand

Joined: Apr 04, 2000
Posts: 39
I tried to use Oracle's JDBC/OCI driver to contact Oracle
database. My computer environment as following:
Window NT 4.O1
Oracle 7.3.4
Java JDK 1.2.2
Oracle8i 8.1.6.0.1 JDBC-OCI/WIN NT driver for JDK1.2
I can compile the following codes:
<CODE>
import java.net.URL;
import java.sql.*;
public class jdbc3{
public static void main(String args[]) {
String url = "jdbc racle ci8:@ORCL";
Connection con;
String createString;
createString = "insert into SUP(SUP_ID,SUP_NAME,STREET,
CITY,STATE,ZIP)"+"VALUES(102,'Tofu,Inc.','99 Passaic
Street','Passaic','NJ','07009');";
Statement stmt;
try {
DriverManager.registerDriver (new oracle.jdbc.driver.
OracleDriver());
con = DriverManager.getConnection(url, "xxx",
"xxxxxx");
stmt = con.createStatement();
stmt.executeUpdate(createString);
stmt.close();
con.close();
}
catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
}
}
</CODE>
However, I failed to run the above code in Java. I always got
the same wrong message as following:
Exception in the thread"main" java.lang.NoClassDefFoundError:
oracle/jdbc/driver/oracleDriver

This thing drove me crazy. I checked all the oracle documents
about JDBC/OCI driver.It seems that the envrionment setting is
fine, the code is fine and it can compile. But it just does not
work.
Thanks for all possible helps for this problem.
Wai


Milind Kulkarni
Ranch Hand

Joined: Jun 01, 2000
Posts: 146
Hi Wai,
Such and similar kinds of errors are encountered if your driver programs or the code that you have written are not in classpath.
Regards,
Milind

[This message has been edited by Milind Kulkarni (edited July 05, 2000).]
siva kumar
Greenhorn

Joined: Jul 05, 2000
Posts: 4
hi friend
if u use oracle database.u should use orcledriver.
java has got 4 drivers.but that will not use for oracle
database.u can try out.

`
Wai Iu
Ranch Hand

Joined: Apr 04, 2000
Posts: 39
Thanks Kulkarni and Kumar. I have two points needed to be
clarified here:
1. My oracle driver is called classes111.zip. It is located in
the directory c:\jdbc . My code is called jdbc3.java. When
I compiled the code, I used the command:
<CODE>
javac -classpath c:\jdbc\classes111.zip jdbc3.java
</CODE>
It compiled. But when I run the code, It just did not work.
2.Oracle8i 8.1.6.0.1 JDBC-OCI/WIN NT driver is Oracle's type 2
JDBC driver for window NT, not from other vendors.
Please help me out.
Wai
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
Originally posted by Wai Iu:
Thanks Kulkarni and Kumar. I have two points needed to be
clarified here:
1. My oracle driver is called classes111.zip. It is located in
the directory c:\jdbc . My code is called jdbc3.java. When
I compiled the code, I used the command:
<CODE>
javac -classpath c:\jdbc\classes111.zip jdbc3.java
</CODE>
It compiled. But when I run the code, It just did not work.
2.Oracle8i 8.1.6.0.1 JDBC-OCI/WIN NT driver is Oracle's type 2
JDBC driver for window NT, not from other vendors.
Please help me out.
Wai

You need to be 100% sure you have the right driver, Oracle in their wisdom have all the drivers in a file called classes111.zip(there is one for 7.3.4 database, one for the 8.0.5 database etc.), however you have to have the right one. The best way is to go to Oracle site and download the most recent OCI driver for an 8i database. For 8.1.6 database version they have drivers for jdk 1.1 and 1.2 they can be found here: http://technet.oracle.com/software/tech/java/sqlj_jdbc/software_index.htm

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Wai,
Were you able to figure it out. I am having the same problem even after downloading the latest jdbc driver.
Please let me know on how to connect to oracle.
Thanks
Originally posted by Wai Iu:
Thanks Kulkarni and Kumar. I have two points needed to be
clarified here:
1. My oracle driver is called classes111.zip. It is located in
the directory c:\jdbc . My code is called jdbc3.java. When
I compiled the code, I used the command:
<CODE>
javac -classpath c:\jdbc\classes111.zip jdbc3.java
</CODE>
It compiled. But when I run the code, It just did not work.
2.Oracle8i 8.1.6.0.1 JDBC-OCI/WIN NT driver is Oracle's type 2
JDBC driver for window NT, not from other vendors.
Please help me out.
Wai

 
Consider Paul's rocket mass heater.
 
subject: Problem with Oracle's JDBC/OCI driver