• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with Oracle's JDBC/OCI driver

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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


 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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


reply
    Bookmark Topic Watch Topic
  • New Topic