0
我寫了下面的簡單代碼:錯誤使用JDBC-ODBC橋驅動程序連接到Oracle
import java.sql.*;
public class Select_Type1 {
public static void main(String[] args) throws SQLException{
DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
Connection con = DriverManager.getConnection("jdbc:odbc:oradsn","system","password");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from EMPLOYEE");
while(rs.next())
{
System.out.println("Emplyee_id: "+rs.getInt(1));
System.out.println("Employee_Name: "+rs.getString(2));
System.out.println("Employee_Salary: "+rs.getInt(3));
System.out.println("------------------------------");
}
}
}
下面一行是erronomous: - DriverManager.registerDriver(新sun.jdbc.odbc.JdbcOdbcDriver中( ));
的錯誤是: -
- Access restriction: The type JdbcOdbcDriver is not accessible due to restriction on required library C:\Program Files\Java\jre7\lib\rt.jar
- Access restriction: The constructor JdbcOdbcDriver() is not accessible due to restriction on required library C:\Program Files\Java\jre7\lib\rt.jar
的任何幫助,將不勝感激。
做了沒有改變:-( – Vivek