Below is my simple code trying to get the preparedStatement to work. Trying the batchupdate process for the first time. When the first ps.addBatch() (code below) executes, it gives me the following error message:
java.lang.AbstractMethodError: COM.ibm.db2.jdbc.app.DB2PreparedStatement.addBatch()V[b]
I see that the AbstractMethodError is thrown when an application tries to call an abstract method and this error can only occur at run time if the definition of some class has incompatibly changed since the currently executing method was last compiled.
But I am confused. Is my version of DB2 Version 7 incompatible with my J2RE1.4.1_05???? Completely lost with this one...
public void updateEOD() {
try {
PreparedStatement ps;
String sqlUpdate =
"update eod_data " +
"set " +
",DESCRIPTION1 = ? " +
"" +
"where l_id = ?";
ps = con.prepareStatement(sqlUpdate);
ps.setString(1,"This description 1");
ps.setInt(2,580);
ps.addBatch();
ps.setString(1,"This description 2");
ps.setInt(2,581);
ps.addBatch();
int [] updateCounts = ps.executeBatch();
} catch (SQLException e ){
while (e != null){
System.out.println("Message " + e.getMessage());
System.out.println("SQL State " + e.getSQLState());
System.out.println("SQL Code " + e.getErrorCode());
e = e.getNextException();
System.out.println("");
}
e.printStackTrace();
return;
}
}