我正在尝试使用
Java设置网络超时我的Oracle数据库连接.但是,我收到了一个错误.下面是示例代码,它是相应的例外.
try{
conn = new Database("oracle").connect();
conn.setNetworkTimeout(null, 30000); //I don't have an Executor, so the field is set to null
System.out.println(Switch.date() + " -> Database Connection Initialized");
}
catch(SQLException ex){
Logger.getLogger(Switch.class.getName()).log(Level.SEVERE, null, ex);
}
我得到的例外是:
Exception in thread "main" java.lang.AbstractMethodError:oracle.jdbc.driver.T4CConnection.setNetworkTimeout(Ljava/util/concurrent/Executor;I)V
at ke.co.smart.Switch.(Switch.java:524)
at ke.co.smart.Switch.main(Switch.java:161)
Java Result: 1
我认为它与抽象方法(读取AbstractMethodError)有关.什么可能导致这个错误,因为我只实现了我认为已经在Java中定义的方法,因此,不拒绝编译.
N.B.:如果有抽象方法,Java不允许编译具体类.