• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems with OCI-JDBC application

 
Ramnath Krishnan
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am having some problems implementing a simple jdbc-oci stand-alone application.
I am using.
Oracle for Solaris - 7.3.4
Java - 1.2
Client System : Windows NT 4.0
My Path information includes the files that I downloaded from the Oracle Site for oci - jdbc drivers.
My code:
public static void main(String[] args)
{
Class.forName("oracle.jdbc.driver.OracleDriver");
String databaseURL = "jdbc racle ci8:@databaseName";
Connection conn = DriverManager.getConnection(databaseURL,"scott","tiger");
/* some createStatement() and resultset code
here */
}
The runtime error:
java.lang.UnsatisfiedLinkError: no ocijdbc8 in shared library path
at java.lang.Throwable.<init>(Throwable.java:74)
at java.lang.Error.<init>(Error.java:46)
at java.lang.LinkageError.<init>
LinkageError.java:39)
at java.lang.UnsatisfiedLinkError.<init>(UnsatisfiedLinkError.java:38)
at java.lang.Runtime.loadLibrary(Compiled Code)
at java.lang.System.loadLibrary(System.java:554)
at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:202)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:156)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:231)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:208)
at java.sql.DriverManager.getConnection(DriverManager.java:90)
at java.sql.DriverManager.getConnection(DriverManager.java:132)
at HTMLSelect.main(HTMLSelect.java)
Process Exit...
After researching I feel the problems could be :
1. The oci-jdbc library that I downloaded from the Oracle Site does not work for JDK1.2.2
2.The error message states the ocijdbc8 not found in the library path... and none of the files I downloaded from the oracle site has a similar file name.
3.I tried both drivers for Oracle 8.0.5 and Oracle 7.3.4 ( when connectionString used for oci7 - gives me an Invalid URL specified error - eventhough I run Oracle sample code
for oci7).
If anyone has successfully implemented oci-jdbc application/servlet, can they please explain
1. the drivers that was used ( with the java version 1.2.2)
2. the classpath and path changes...
3. Finally( although I think the source code is correct) but if another connectionString seems to work ...that's fine too.
Thanks in advance and appreciate any suggestion/solution in this regard.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Ramnath,
First of all check if the JDBC driver that you have downloaded is for Oracle 7.3.This creates an error many times.
Anyway I am sending your a piece of code which is working on a similar setup.
1)Ensure that the the oracle.jdbc.driver.OracleDriver class is available to the system by having a proper classpath.
2) The code with all the details is as follows.

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Ramnath,
First of all check if the JDBC driver that you have downloaded is for Oracle 7.3.This creates an error many times.
Anyway I am sending your a piece of code which is working on a similar setup.
1)Ensure that the the oracle.jdbc.driver.OracleDriver class is available to the system by having a proper classpath.
2) The code with all the details is as follows.
a) Connection conn =null;
b) Class.forName("oracle.jdbc.driver.OracleDriver");
c) DriverManager.registerDriver (new Oracle.jdbc.driver.OracleDriver ());
d)conn = DriverManager.getConnection ("jdbc racle:thin:@<IP_address of oracle server>:1521:<SID of database>","<username>", "<password>");
e) Statement stmt = conn.createStatement();
f) ResultSet rs = stmt.executeQuery("sql select statement");
Hope this is clear.Try it and I am sure it will work.
** Are you using any java native methods generally the error that u r getting "unsatisfied link error" is encountered if the JVM is not able to load a dll from the specified paths.
Cheers
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic