Newbie ?: problem running an Oracle JDBC example

From: Bonminh Lam <no_spam_at_bmlam.de>
Date: Sun, 17 Dec 2000 12:58:37 +0100
Message-ID: <3A3CAA6D.D8933E04_at_bmlam.de>


I have Oracle 8.0.4 and JDK 1.2 installed on an NT machine.

The following example taken from $ORACLE_HOME/jdbc/samples/oci8 works when I used the java binary from$ORACLE_HOME/jdk/bin:

//    ******************   begin of Employee.java
/*
  • This sample shows how to list all the names from the EMP table
    *
  • It uses the JDBC OCI8 driver. See the same program in the
  • thin or oci7 samples directories to see how to use the other drivers.

*/

// You need to import the java.sql package to use JDBC import java.sql.*;

public class Employee
{
  public static void main (String args [])

       throws SQLException, ClassNotFoundException   {
    // Load the Oracle JDBC driver
    Class.forName ("oracle.jdbc.driver.OracleDriver");

    // Connect to the database
    // You can put a database name after the _at_ sign in the connection URL.
    Connection conn =
      DriverManager.getConnection ("jdbc:oracle:oci8:_at_orcl", "scott", "tiger");

    // Create a Statement
    Statement stmt = conn.createStatement ();

    // Select the ENAME column from the EMP table     ResultSet rset = stmt.executeQuery ("select ENAME, job from EMP");

    // Iterate through the result and print the employee names     while (rset.next ()) {

      System.out.println (rset.getString (1));
                }

  }
}
//    ******************   end of Employee.java



The following commands works:

D:\orant84\jdbc\samples\oci8>d:\orant\jdk\bin\java Employee SMITH
ALLEN
WARD However, when I run the programme with the java binary supplied with SDK2 and which I want to use by default, it breaks with the following error:

D:\orant84\jdbc\samples\oci8>java Employee Exception in thread "main" java.lang.UnsatisfiedLinkError: make_c_state

        at oracle.jdbc.oci7.OCIDBAccess.make_c_state(Native Method)
        at oracle.jdbc.oci7.OCIDBAccess.logon(OCIDBAccess.java:142)
        at
oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:93)
        at
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:147)
        at java.sql.DriverManager.getConnection(DriverManager.java:517)
        at java.sql.DriverManager.getConnection(DriverManager.java:177)
        at Employee.main(Employee.java:21)


My CLASSPATH is set as :

D:\orant84\jdbc\samples\oci8>echo %CLASSPATH% C:\Programme\PhotoDeluxe BE
1.0\AdobeConnectables;D:\orant84\jdbc\lib\classes111.zip;.

One thing that looks suspicous is that the SDK1.2 Java interpreter seems to be using OCI7, although in the source code, OCI8 is specified. Not sure whether this is relavant. Also please dont get confused with the obviously different Oracle homes, I somehow had to use different Oracle homes when installing the Oracle client stuff besides the server code.

I would appreciate any help or hints to the right direction there. Thanks.

--
To reply to me directly, please mail to: bmlam at online dot de
Received on Sun Dec 17 2000 - 12:58:37 CET

Original text of this message