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

Oracle 8i: Cannot access db from Java using Oracle OCI driver

2 views
Skip to first unread message

horwinkle

unread,
Jan 4, 2003, 4:27:41 PM1/4/03
to
I'm running Oracle 8i Personal Edition on Windows 98.
I have the Java 2 (v 1.4.1_01) installed.

I can access Oracle tables using the JDBC / ODBC driver. This works fine:

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:odbc:<db-host>",
"<user>", "<pwd>");
Statement stmt = conn.createStatement();
ResultSet res = stmt.executeQuery(...);

But I cannot do so using the Oracle OCI driver. This fails:

* Connection conn =
DriverManager.getConnection("jdbc:oracle:oci8:@<db-host>", "<user>",
"<pwd>");
Statement stmt = conn.createStatement();
stmt.execute(...);

The error occurs in the line marked with * above. The stack trace is:

java.lang.UnsatisfiedLinkError: get_env_handle
at oracle.jdbc.oci8.OCIEnv.get_env_handle(Native Method)
at oracle.jdbc.oci8.OCIEnv.getEnvHandle(OCIEnv.java:70)
at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:359)
at
oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:252)
at
oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:365)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at MyCode.main(MyCode.java:27)

For some reason, it cannot find the native method get_env_handle(). I have
no idea where it should be located.

On Oracle's MetaLink, there have been numerous postings about this problem.
The solution was to make sure that the "classes12.zip" file is in place (it
is!) and that it's included in the PATH (it is!).

But anyway, that seems irrelevant, because "classes12.zip" contains a bunch
of Java .class files ... no native code there at all.

Help!

Andy Flowers

unread,
Jan 4, 2003, 5:14:29 PM1/4/03
to
Do you have the Oracle 8i client installed ?, and are the oracle directories
in your path ?

The OCI Java driver is a thin Java layer around the OCI dlls (in Oracle 8i
you should have oci.dll in the path).

"horwinkle" <whadda...@whaddayamean.com> wrote in message
news:T5IR9.3010$566....@news.bellsouth.net...


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.435 / Virus Database: 244 - Release Date: 30/12/2002


Linda Radecke

unread,
Jan 4, 2003, 7:44:11 PM1/4/03
to

horwinkle wrote:
> I'm running Oracle 8i Personal Edition on Windows 98.
> I have the Java 2 (v 1.4.1_01) installed.
>
> I can access Oracle tables using the JDBC / ODBC driver. This works fine:
>
> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
> Connection conn = DriverManager.getConnection("jdbc:odbc:<db-host>",
> "<user>", "<pwd>");
> Statement stmt = conn.createStatement();
> ResultSet res = stmt.executeQuery(...);
>
> But I cannot do so using the Oracle OCI driver. This fails:

Have you tried to connect via Oracles thin-driver?:

String url =
"jdbc:oracle:thin:@<host>:<port>:<SID>";

DriverManager.getConnection(url, "<user>", "<pwd>");

Hope this helps - Linda
--
* ). and the stars over us was sparkling ever so fine; and down by the
village was the river, a whole mile broad, and awful still and grand.
~-_-..__...-~-._..-~~...The Adventures Of Huckleberry Finn *Mark Twain

0 new messages