You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by ahmet dalli <la...@yahoo.com> on 2002/07/05 12:29:33 UTC

Tomcat4.04+Oracle8i(8.1.7)+JDBC/OCI HOWTO(some hints...)

Hi all,

Here is what i learned from two days trying to access
an Oracle8i database using OCI driver.

1)In order to use OCI driver, you should have an
Oracle client installed. Suppose you have installed
Oracle8i(8.1.7) client from cd, and now you go to
otn(otn.oracle.com) and download the suitable JDBC/OCI
driver(Oracle8i 8.1.7.1 JDBC/OCI Driver) and after
renaming the "classes12.zip" file as "classes12.jar"
for Tomcat, you put it into somewhere so that
CLASSPATH references it, or directly into
%JAVA_HOME%\jre\lib\ext.

You are sure that you have the "ocijdbc8.dll" is in
your PATH(possibly in %ORAHOME%\bin) and you have also
confirmed that it could be loaded by a simple test
program using "System.loadLibrary("ocijdbc8");".
You have a very simple test servlet that has tese
critical lines:
^^^^^^^^^^^^^^^^^^^^^^^^^^
DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver());
conn =
DriverManager.getConnection("jdbc:oracle:oci8:@database","username","password");
^^^^^^^^^^^^^^^^^^^^^^^^^^
where database is of the form "host:port:SID"

Now you try to access the URL
http://localhost/servlet/OracleOCIServlet (or
localhost:8080... if you use Tomcat without Apache)
and what you get is a 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ServletException with a root cause of
java.lang.UnsatisfiedLinkError:get_env_handle.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

You confirm that your simple program works with the
"thin" driver, you apply to Oracle metalink to no
avail...and you are stuck!!! 

First, this UnsatisfiedLinkError : " ...indicates that
you have a mismatch between your JDBC classes file and
your Oracle client version. The giveaway here is the
message stating that a needed library file cannot be
found. For example, you may be using a classes12.zip
file from Oracle Version 8.1.6 with a Version 8.1.5
Oracle client. The classeXXXs.zip file and Oracle
client software versions must match."(Java Programming
with Oracle JDBC, from O'reilly).

Second, give up the driver you have downloded from
otn, go to the directory %ORAHOME%\jdbc\lib and use
the classes12.zip file there....

This will rescue you from this UnsatisfiedLinkError.

2)You have so far changed the classes12.zip file from
otn with the one that came with your client
installation, and now you get this error:

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ORA-06401 NETCMN: invalid driver designator
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

First, Oracle documentation says :
"Cause: The login (connect) string contains an invalid
driver designator.
Action: Correct the string and re-submit."

Second, change the database(of the form
"host:port:SID") with this one:

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(description=(address=(host=myhost)(protocol=tcp)(port=1521))(connect_data=(sid=orcl)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Now, if everything else is pure, you must be accessing
Oracle8i.

I hope these hints can help somebody struggling with
Tomcat/Oracle couple via OCI driver...

Baris....


__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>