I'm trying to set a network time-out my Oracle database Connection in Java. However, I'm getting an error. Below is sample code and it's respective exception.
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);
}
The Exception I'm getting is:
Exception in thread "main" java.lang.AbstractMethodError:oracle.jdbc.driver.T4CConnection.setNetworkTimeout(Ljava/util/concurrent/Executor;I)V
at ke.co.smart.Switch.<init>(Switch.java:524)
at ke.co.smart.Switch.main(Switch.java:161)
Java Result: 1
I believe it has to do with a method being abstract (read AbstractMethodError). What could probably cause this error as I have only implemented the method which I think is already defined within Java, and thus, does not refuse to compile.
N.B.: Java does not allow compilation of concrete classes if there are abstract methods.