Cannot connect with OCI driver and Oracle 9i (9.2)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David

    Cannot connect with OCI driver and Oracle 9i (9.2)

    Hello all,

    I have been trying to use the OCI driver to connect to Oracle 9i, but
    have been getting the following error:

    java.sql.SQLExc eption: Closed Connection
    at oracle.jdbc.dba ccess.DBError.t hrowSqlExceptio n(DBError.java: 134)
    at oracle.jdbc.dba ccess.DBError.t hrowSqlExceptio n(DBError.java: 179)
    at oracle.jdbc.oci 8.OCIDBAccess.c heck_error(OCID BAccess.java:23 64)
    at oracle.jdbc.oci 8.OCIDBAccess.l ogon(OCIDBAcces s.java:480)
    at oracle.jdbc.dri ver.OracleConne ction.<init>(Or acleConnection. java:360)
    at oracle.jdbc.dri ver.OracleDrive r.getConnection Instance(Oracle Driver.java:521 )
    at oracle.jdbc.dri ver.OracleDrive r.connect(Oracl eDriver.java:32 5)
    at java.sql.Driver Manager.getConn ection(DriverMa nager.java:517)
    at java.sql.Driver Manager.getConn ection(DriverMa nager.java:177)
    at TestOCI.main(Te stOCI.java:17)

    Here's my setup:
    .. Running on 'SunOS beavis 5.7 Generic_106541-17 sun4u sparc
    SUNW,Ultra-5_10'
    .. java version is 'Java(TM) 2 Runtime Environment, Standard Edition
    (build 1.3.1-b24)'
    .. echo $LD_LIBRARY_PAT H -/users/david/TestOCI/9.2.0.3:/oracle/lib
    .. in the '9.2.0.3' directory, I have the following files:
    classes12_g9203 .zip, libheteroxa9.so , libheteroxa9_g. so,
    libocijdbc9.so, libocijdbc9_g.s o (downloaded from the oracle driver
    section)

    And the sample program that I run, TestOCI.java:

    import java.sql.*;
    public final class TestOCI {

    private static final String DRIVER = "oracle.jdbc.Or acleDriver";
    private static final String URL = "jdbc:oracle:oc i8:@zool";

    public static void main(String[] args) {

    try {
    Class.forName(D RIVER);
    Connection con = DriverManager.g etConnection(UR L,"user", "pw");
    Statement stmt = con.createState ment();
    } catch (Exception e) {
    e.printStackTra ce();
    }
    }
    }

    I have tried to change the URL to 'oci' instead of 'oci8', same
    result. It does work perfectly if I use the thin driver however.
    This is run with the classpath explicitely set to
    '/users/david/TestOCI/9.2.0.3/classes12_g9203 .zip:.'
    I have also tried to run DbVisualizer (java client) against Oracle
    with the same setup, and I get the very same exception.

    Does anyone have a clue/pointer?
    Thanks
  • Dave Hau

    #2
    Re: Cannot connect with OCI driver and Oracle 9i (9.2)

    You need two more shared object files:

    libclntsh.so.9. 0
    libwtc9.so

    Cheers,
    Dave




    David wrote:
    Hello all,
    >
    I have been trying to use the OCI driver to connect to Oracle 9i, but
    have been getting the following error:
    >
    java.sql.SQLExc eption: Closed Connection
    at oracle.jdbc.dba ccess.DBError.t hrowSqlExceptio n(DBError.java: 134)
    at oracle.jdbc.dba ccess.DBError.t hrowSqlExceptio n(DBError.java: 179)
    at oracle.jdbc.oci 8.OCIDBAccess.c heck_error(OCID BAccess.java:23 64)
    at oracle.jdbc.oci 8.OCIDBAccess.l ogon(OCIDBAcces s.java:480)
    at oracle.jdbc.dri ver.OracleConne ction.<init>(Or acleConnection. java:360)
    at oracle.jdbc.dri ver.OracleDrive r.getConnection Instance(Oracle Driver.java:521 )
    at oracle.jdbc.dri ver.OracleDrive r.connect(Oracl eDriver.java:32 5)
    at java.sql.Driver Manager.getConn ection(DriverMa nager.java:517)
    at java.sql.Driver Manager.getConn ection(DriverMa nager.java:177)
    at TestOCI.main(Te stOCI.java:17)
    >
    Here's my setup:
    . Running on 'SunOS beavis 5.7 Generic_106541-17 sun4u sparc
    SUNW,Ultra-5_10'
    . java version is 'Java(TM) 2 Runtime Environment, Standard Edition
    (build 1.3.1-b24)'
    . echo $LD_LIBRARY_PAT H -/users/david/TestOCI/9.2.0.3:/oracle/lib
    . in the '9.2.0.3' directory, I have the following files:
    classes12_g9203 .zip, libheteroxa9.so , libheteroxa9_g. so,
    libocijdbc9.so, libocijdbc9_g.s o (downloaded from the oracle driver
    section)
    >
    And the sample program that I run, TestOCI.java:
    >
    import java.sql.*;
    public final class TestOCI {
    >
    private static final String DRIVER = "oracle.jdbc.Or acleDriver";
    private static final String URL = "jdbc:oracle:oc i8:@zool";
    >
    public static void main(String[] args) {
    >
    try {
    Class.forName(D RIVER);
    Connection con = DriverManager.g etConnection(UR L,"user", "pw");
    Statement stmt = con.createState ment();
    } catch (Exception e) {
    e.printStackTra ce();
    }
    }
    }
    >
    I have tried to change the URL to 'oci' instead of 'oci8', same
    result. It does work perfectly if I use the thin driver however.
    This is run with the classpath explicitely set to
    '/users/david/TestOCI/9.2.0.3/classes12_g9203 .zip:.'
    I have also tried to run DbVisualizer (java client) against Oracle
    with the same setup, and I get the very same exception.
    >
    Does anyone have a clue/pointer?
    Thanks

    Comment

    • David

      #3
      Re: Cannot connect with OCI driver and Oracle 9i (9.2)

      Dave Hau <davehau_nospam _123@nospam_net scape.netwrote in message news:<3EF76D38. 2040704@nospam_ netscape.net>.. .
      You need two more shared object files:
      >
      libclntsh.so.9. 0
      libwtc9.so

      Thanks, but it doesn't seem to be the problem since I do have these
      files in /oracle/lib (which is in my LD_LIBRARY_PATH ).

      Comment

      Working...