我正在尝试使用jdbc连接到Oracle 11g,但是它给了我错误。我已经下载并保存了eclipse中的jar(ojdbc6dms.jar和ojdbc6dms_g.jar),但仍然给出错误
public static Connection getDatabaseConnection() throws SQLException,
InstantiationException, IllegalAccessException,
ClassNotFoundException {
Connection con = null;
// initialising drive
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
// load driver
con = DriverManager.getConnection(
"jdbc:oracle:thin:@10.16.52.79:1521:TST", "rep",
"Appe");
String dbName = con.getMetaData().getDatabaseProductName();
System.out.println(" Conected to DB " + dbName);
return con;
} // insertRecordsToDB
Exception in thread "main" java.lang.NoClassDefFoundError: oracle/dms/console/DMSConsole
at oracle.jdbc.driver.DMSFactory.<clinit>(DMSFactory.java:45)
at oracle.jdbc.driver.PhysicalConnection.createDMSSensors(PhysicalConnection.java:4203)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:629)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:218)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:29)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:538)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at
只是想知道哪个jar有类oracle/dms/console/DMSConsole
。因为当我检查这些罐子时,这个类不可用
答案 0 :(得分:0)
JDBC driver download page for Oracle 11g的文件为ojdbc6dms.jar,其中包含oracle.jdbc.driver.DMSFactory。
编辑:根据@ JavaGeek的评论,这个jar实际上并不包含DMSConsole类。所需的类在Oracle Server安装中的位置$ORACLE_HOME/oc4j/lib/dms.jar
中可用。服务器下载也可在Oracle TechNetwork