JdbcOdbcBatchUpdateException

Mahmoud Hadad

Ranch Hand

Posts: 67

posted 10 years ago

i'm trying to save changes done in my DB using streams as arrays of strings.anyway when i use the addBatch() it works well but when i try to execute the method executeBatch() it throws these exceptions: sun.jdbc.odbc.JdbcOdbcBatchUpdateException: General error at sun.jdbc.odbc.JdbcOdbcStatement.emulateBatchUpdate(JdbcOdbcStatement.java:1097) at sun.jdbc.odbc.JdbcOdbcStatement.executeBatchUpdate(JdbcOdbcStatement.java:930) at sun.jdbc.odbc.JdbcOdbcStatement.executeBatch(JdbcOdbcStatement.java:912)

before using the addBatch() ,i used the println() to see the sql statements before using addBatch() all of them was INSERT INTO and there was nothing wrong in them.addBatch() is executing normally but executeBactch() throws the exception i have mentioned.here is the mechanism i'm using for executing both methods addBatch() and executeBatch().i have a class called GeneralFrame.this class have an object of another class called DBChanges(this class is responsible for taking a Connectionobject from GeneralFrame and then createStatement() then i have two methods in thsi class one called addChanges(stringObject) which takes a string object then executes the stmt.addBatch(theStringObject) so this method(addChanges())is called from GeneralFrame many times.after the method addChanges() and the loop in GeneralFrame finishes another method called DBChanges.updateChanges() this method just do stmt.executeUpdate() evreything was fine before i call DBChanges.updateChanges() from GeneralFrame class) i tryed to call getUpdateCount() ,but there were no updated rows.so do you have any ideas?

yes i'm calling a method called addChanges() which takes a string that reprsents one sql statement within a loop from GeneralFrame.this method addChanges(aStringObject) is called three times and this method addChanges() executes stmt.addBatch(theStringValue) each time after that control returns to GeneralFrame which executes another method called updateChanges() which executes the method stmt.executeBatch() and here the exception is thrown and none of my statements are executed. any ideas?