Re: JDBC

From: Sam Fredland <designinsites_at_home.com>
Date: 2000/01/04
Message-ID: <F7vc4.3913$VZ2.22316_at_news1.alsv1.occa.home.com>#1/1


Cindy,

Thanks. I looked at the document. I'm not sure whether I have the thin or the OCI driver. I ran the following sample program:

import oracle.jdbc.driver.*;
import java.sql.*;

public class JDBCTest {

 public static void main(String[] argv) throws Exception, SQLException {   String dbURL = argv[0];
  System.out.println( dbURL );
  String username = "ucboulder";
  String password = "ucboulder";

  try {
   Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (Exception e) {
   e.printStackTrace();
   throw new Exception("Cannot load Driver " + "oracle.jdbc.driver.OracleDriver");
}

  try {
   Connection conn = DriverManager.getConnection(dbURL, username, password);
} catch (SQLException e) {
   e.printStackTrace();
   throw new SQLException(e.getMessage());
}

 }
}

The results for both the thin and OCI drivers were:



java JDBCTest
jdbc:oracle:oci8:_at_(description=(address=(host=localhost)(protocol=tcp)(port= 1521))(connect_data=(sid=myp)))
jdbc:oracle:oci8:_at_(description=(address=(host=localhost)(protocol=tcp)(port= 1521))(connect_data=(sid=myp)))
Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc8 in java.library.path
 at java.lang.ClassLoader.loadLibrary(ClassLoader.java, Compiled Code)
 at java.lang.Runtime.loadLibrary0(Runtime.java, Compiled Code)
 at java.lang.System.loadLibrary(System.java, Compiled Code)
 at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java, Compiled Code)  at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java, Compiled Code)
 at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java, Compiled Code)
 at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java, Compiled Code)
 at java.sql.DriverManager.getConnection(DriverManager.java, Compiled Code)
 at java.sql.DriverManager.getConnection(DriverManager.java, Compiled Code)
 at JDBCTest.main(JDBCTest.java, Compiled Code)


java JDBCTest jdbc:oracle:thin:_at_localhost:1521:myp jdbc:oracle:thin:_at_localhost:1521:myp
java.sql.SQLException: The Network Adapter could not establish the connection
 at oracle.jdbc.dbaccess.DBError.check_error(DBError.java, Compiled Code)  at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java, Compiled Code)
 at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java, Compiled Code)
 at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java, Compiled Code)
 at java.sql.DriverManager.getConnection(DriverManager.java, Compiled Code)
 at java.sql.DriverManager.getConnection(DriverManager.java, Compiled Code)
 at JDBCTest.main(JDBCTest.java, Compiled Code)
Exception in thread "main" java.sql.SQLException: The Network Adapter could not establish the connection
 at JDBCTest.main(JDBCTest.java, Compiled Code)

which makes me believe I'm not running a thin driver. But I've no idea what to make of:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc8 in java.library.path

Any idea?

-Sam Received on Tue Jan 04 2000 - 00:00:00 CET

Original text of this message