Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

2 views
Skip to first unread message

David

unread,
Jun 20, 2003, 1:54:36 PM6/20/03
to
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.SQLException: Closed Connection
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:2364)
at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:480)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:360)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:521)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:325)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at TestOCI.main(TestOCI.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_PATH -> /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.so (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.OracleDriver";
private static final String URL = "jdbc:oracle:oci8:@zool";

public static void main(String[] args) {

try {
Class.forName(DRIVER);
Connection con = DriverManager.getConnection(URL,"user", "pw");
Statement stmt = con.createStatement();
} catch (Exception e) {
e.printStackTrace();
}
}
}

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
--
david

David

unread,
Jun 23, 2003, 4:59:09 PM6/23/03
to

Dave Hau

unread,
Jun 23, 2003, 5:12:28 PM6/23/03
to
You need two more shared object files:

libclntsh.so.9.0
libwtc9.so

Cheers,
Dave

David

unread,
Jun 24, 2003, 2:52:25 PM6/24/03
to
Dave Hau <davehau_nospam_123@nospam_netscape.net> wrote 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).

Joseph Weinstein

unread,
Jun 24, 2003, 3:53:00 PM6/24/03
to David
The problem (if as you say, you can connect via the thin driver) is that for the OCI-based
driver, you must specify the DBMS according to the entry in the tnsnames.ora file, not
by machine name as for the thin driver. I assume you have your ORACLE_HOME environment
variable set correctly, and have an entry in the tnsnames.ora file for the DBMS you want to
connect to.
Joe Weinstein at BEA
0 new messages