aspose file tools*
The moose likes JDBC and the fly likes Problem connecting to an Oracle database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem connecting to an Oracle database" Watch "Problem connecting to an Oracle database" New topic
Author

Problem connecting to an Oracle database

Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 573
I have got very confused with my settings.
If I use the code :
conn = DriverManager.getConnection("jdbc racle ci8:@"+"CAVDB","SYSTEM","t1929");.
I get an error message:
java.lang.UnsatisfiedLinkError: no ocijdbc8 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1344)
at java.lang.Runtime.loadLibrary0(Runtime.java:744)
at java.lang.System.loadLibrary(System.java:815)
at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:228)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:246)
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:172)
at roleOne.server.<init>(server.java:36)
at roleOne.server.main(server.java:195)
But I dont have ocijdbc8 instead I have ocijdbc9, which I have set in my path.
C:\PROGRA~1\RATIONAL\RATION~1\NUTCROOT\bin;
C:\PROGRA~1\RATIONAL\RATION~1\NUTCROOT\bin\x11;
C:\PROGRA~1\RATIONAL\RATION~1\NUTCROOT\mksnt;
C:\jdk1.3.1_04\jre\bin;.;C:\WINDOWS\System32;C:\WINDOWS;.;
C:\jdk1.3.1_04\bin;C:\j2sdkee1.3.1\bin;C:\jakarta-ant-1.3\bin;
C:\bea\wlserver6.1\bin\oci816_8;C:\oracle\ora90\bin;
C:\oracle\ora90\Apache\Perl\5.00503\bin\mswin32-x86;
C:\Program Files\Oracle\jre\1.1.8\bin;
C:\oracle\ora90\jdbc\lib\classes111.zip;
C:\oracle\ora90\BIN\ocijdbc9;C:\WINDOWS\system32;
C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\WINDOWS\COMMAND;
C:\Program Files\Rational\common;C:\Program Files\Rational\ClearQuest;
C:\Program Files\Rational\Rose\TopLink\;C:\Program Files\Rational\Rational Test
So I have chabged the code to :
conn = DriverManager.getConnection("jdbc racle ci9:@"+"CAVDB","SYSTEM","t1929");
This code works but when I get to the next line of code :
try
{
System.out.println("Server() create statement");
Statement stmt = conn.createStatement();
}
catch(Exception e)
{
System.out.println("Server() problem creating statement");
e.printStackTrace();
System.exit(1);
}
I get the error message:
Server() problem creating statement
java.lang.NullPointerException
at roleOne.server.<init>(server.java:53)
at roleOne.server.main(server.java:219)
Classpath is set to:
.;C:\jdk1.3.1_04\lib\tools.jar;
C:\j2sdkee1.3.1\lib\j2ee.jar;
C:\bea;C:\bea\wlserver6.1\lib\weblogic.jar;
C:\oracle\ora90\jdbc\lib\classes111.zip;
C:\projects\jakarta-Tomcat-4.0\bin\bootstrap.jar
I am using
Oracle9i Enterprise Edition Release 9.0.1.1.1 - Production
JServer Release 9.0.1.1.1 - Production
and Java is jdk1.3.1_04.
Thanks for any help
Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 573
I have found the problem, if I add C:\bea\wlserver6.1\lib\weblogic.jar; to my Classpath it will ask for ocijdbc8 to be added to my classpath.
Is there a work around as I do not have ocijdbc8 instead I have ocijdbc9.
Do I need to download WebServer7.
Cheers for any help. TE
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem connecting to an Oracle database