Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: JDBC - Novice question

Re: JDBC - Novice question

From: C. Ferguson <c_ferguson_at_rationalconcepts.com>
Date: Fri, 16 Jul 1999 12:28:18 -0700
Message-ID: <378F87D2.6834187@rationalconcepts.com>


Hi Tom,
  I use jdk1.2.1 with Oracle 8.0.4. I downloaded the thin client from Oracle a while ago, but it basically works this way. You download the client from Oracle, extract the classes111.zip file from that download. Do not inflate classes111.zip. Reference this classes111.zip in your classpath.
e.g. javac -classpath .:/export/opt/oracle/ora8/jdbc/lib/classes111.zip *.java

where /export/opt/oracle... is the path to the driver.

Hope that helps.
Cindy

Tom Nixon wrote:

> hi
> I am trying to connect to an Oracle database using JDBC. I'm using JDK
> v1.2.2 and I
> have downloaded the Oracle JDBC driver from their website. I am trying
> to compile an
> example program (see below) and get an error because the class
> oracle.jdbc.driver
> doesn't seem to be anywhere (I have searched the entire hard disk so it
> shouldn't be a
> classpath issue). I had assumed that the purpose of downloading the
> Oracle driver was to
> get this class file. Does anyone know what I am doing wrong?
> cheers
> Tom
>
> here's the sourcecode:
>
> import java.sql.*;
> public class JDBCExample {
> public static void main(String args[]) throws SQLException {
>
> // This line generates the "class not found" compiler error
> DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
>
> Connection conn =
> DriverManager.getConnection("jdbc:oracle:thin:@dlsun137:5521:sol1",
> "scott", "tiger");
> Statement stmt = conn.createStatement();
> ResultSet rs = stmt.executeQuery("select ename, emp");
> while(rs.next()) {
> String name = rs.getString(1);
> int number = rs.getInt(2);
> System.out.println(name + " " + number);
> }
> rs.close();
> conn.close();
> }
> }
Received on Fri Jul 16 1999 - 14:28:18 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US