I'm not really sure about the mixing JDBC and Oracle batching... I read that I can't mix it on one instance of preparedStatment
... because of: Oracle Update Batching Models - Using both batching models in same application
But I also find something saying that it can't be mixed even in a single application... http://docs.oracle.com/cd/B10500_01/java.920/a96654/oraperf.htm
So know I'm not sure where the problem is...
I create a new prepared statment in each call of function:
public void functionCall(int Id)
PreparedStatement insStm = null;
String featureName = "";
String featureTypeName = "";
String sql = "BEGIN insert into " + TABLE_FEATURE_INSET + " values (?, ?, ?, ?); EXCEPTION WHEN others THEN IF SQLCODE != -1 THEN RAISE; END IF; END;";
insStm = getConnection().prepareStatement(sql);
for(xxx)
for (yyy) {
for (zzz) {
insStm.setObject(1, TypeName);
insStm.setObject(2, tableName);
insStm.setObject(3, sourceId);
insStm.setObject(4, Id);
insStm.addBatch();
}
}
// per feature
insStm.executeBatch();
}
statement .close();
}
And then I sometimes get an error...:
Caused by: java.sql.SQLException: operation not allowed: operation cannot be mixed with Oracle-style batching
Maybe is problem that prepareStatment
can be from same connection? I'm really not sure about this.
Can somebody help me? Thanks
EDIT: That error is caused by this call: insStm.addBatch();