哎呀!是mm的jdbc真的不支援準備語句pst或者語句st的批次處理,還是我的程式有錯!!!!快來看看!!!

mdwolf發表於2003-03-14
哎呀!是mm的jdbc真的不支援準備語句pst或者語句st的批次處理,還是我的程式有錯!!!!快來看看!!!

help!!!!
我開始用:

// pst1 = conn.prepareStatement(ISqlName.ORDER_MAIN_ADMIN_DEL_SQL1);
// pst2 = conn.prepareStatement(ISqlName.ORDER_MAIN_ADMIN_DEL_SQL2);
// pst3 = conn.prepareStatement(ISqlName.ORDER_MAIN_ADMIN_DEL_SQL3);
// pst1.setInt(1, i);
// rs = pst1.executeQuery();
//
// while(rs.next()){
// pst2.setInt(1,rs.getInt(1));
// pst2.addBatch();
// pst3.setInt(1,rs.getInt(2));
// pst3.addBatch();
// }
//
// pst2.executeBatch();
// pst3.executeBatch();
//
// b = true;
報錯!

// DBC Driver: org.gjt.mm.mysql.Driver
// java.sql.SQLException: Not implemented
// at org.gjt.mm.mysql.Statement.executeBatch(Statement.java:902)
// at com.cnjsp.db.pool.PooledPreparedStatement.executeBatch(PooledPreparedStatement.java:140)

所以我只好這樣了:


pst1 = conn.prepareStatement(ISqlName.ORDER_MAIN_ADMIN_DEL_SQL1);
pst2 = conn.prepareStatement(ISqlName.ORDER_MAIN_ADMIN_DEL_SQL2);
pst3 = conn.prepareStatement(ISqlName.ORDER_MAIN_ADMIN_DEL_SQL3);
pst1.setInt(1, i);
rs = pst1.executeQuery();

while(rs.next()){
pst2.setInt(1,rs.getInt(1));
pst2.executeUpdate();
pst3.setInt(1,rs.getInt(2));
pst3.executeUpdate();
}

b = true;

相關文章