D
dadabox
Unregistered / Unconfirmed
GUEST, unregistred user!
我試著用JBDC連接Oracle﹐出現下面的錯誤。classpath中我設了
classpath=D:/jdk1.3.0_02/lib;c:/Oracle/Ora81/jdbc/lib/classes12.zip;C:/Oracle/Ora81/jdbc/lib/nls_charset12.zip;.;
在這之前﹐我是設定的classes111.zip和nls_charset11.zip
我的Oracle是8.1.5。
調試程序是Oracle自帶的那個Employee.java﹔
用javac生成Employee.class成功﹐
但用java Employee時出錯。
大俠們﹐快點救救急﹗這是怎么回事呀﹖我想可能是JDBC的問題﹐可我到oracle網站下載
了最新的JDBC DRIVERS還是不行呀。我想classpath和path應該是沒有問題的。
Exception in thread "main" java.lang.UnsatisfiedLinkError: make_c_state
at oracle.jdbc.oci8.OCIDBAccess.make_c_state(Native Method)
at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:233)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:246)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
va:365)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at Employee.main(Employee.java:18)
Employee.java源代碼﹕
/*
* This sample shows how to list all the names from the EMP table
*/
// You need to import the java.sql package to use JDBC
import java.sql.*;
class Employee
{
public static void main (String args [])
throws SQLException
{
// Load the Oracle JDBC driver
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
// Connect to the database
// You can put a database name after the @ sign in the connection URL.
Connection conn =
DriverManager.getConnection ("jdbcracleci8", "scott", "tiger");
// Create a Statement
Statement stmt = conn.createStatement ();
// Select the ENAME column from the EMP table
ResultSet rset = stmt.executeQuery ("select ENAME from EMP");
// Iterate through the result and print the employee names
while (rset.next ())
System.out.println (rset.getString (1));
// Close the RseultSet
rset.close();
// Close the Statement
stmt.close();
// Close the connection
conn.close();
}
}
classpath=D:/jdk1.3.0_02/lib;c:/Oracle/Ora81/jdbc/lib/classes12.zip;C:/Oracle/Ora81/jdbc/lib/nls_charset12.zip;.;
在這之前﹐我是設定的classes111.zip和nls_charset11.zip
我的Oracle是8.1.5。
調試程序是Oracle自帶的那個Employee.java﹔
用javac生成Employee.class成功﹐
但用java Employee時出錯。
大俠們﹐快點救救急﹗這是怎么回事呀﹖我想可能是JDBC的問題﹐可我到oracle網站下載
了最新的JDBC DRIVERS還是不行呀。我想classpath和path應該是沒有問題的。
Exception in thread "main" java.lang.UnsatisfiedLinkError: make_c_state
at oracle.jdbc.oci8.OCIDBAccess.make_c_state(Native Method)
at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:233)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:246)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
va:365)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at Employee.main(Employee.java:18)
Employee.java源代碼﹕
/*
* This sample shows how to list all the names from the EMP table
*/
// You need to import the java.sql package to use JDBC
import java.sql.*;
class Employee
{
public static void main (String args [])
throws SQLException
{
// Load the Oracle JDBC driver
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
// Connect to the database
// You can put a database name after the @ sign in the connection URL.
Connection conn =
DriverManager.getConnection ("jdbcracleci8", "scott", "tiger");
// Create a Statement
Statement stmt = conn.createStatement ();
// Select the ENAME column from the EMP table
ResultSet rset = stmt.executeQuery ("select ENAME from EMP");
// Iterate through the result and print the employee names
while (rset.next ())
System.out.println (rset.getString (1));
// Close the RseultSet
rset.close();
// Close the Statement
stmt.close();
// Close the connection
conn.close();
}
}