日期:2014-05-20 浏览次数:21158 次
try { this.connection.setAutoCommit(false); //操作数据库 this.connection.commit(); } catch(Exception e) { this.connection.rollback(); }
01498 //-------------------------------- 01499 // addBatch() 01500 // adds a set Of Parameters for executeBatch Updates. 01501 //-------------------------------- 01502 01503 public void addBatch() throws SQLException 01504 { 01505 if (OdbcApi.getTracer().isTracing ()){ 01506 OdbcApi.getTracer().trace ("*PreparedStatement.addBatch"); 01507 } 01508 01509 try 01510 { 01511 int storedSize; 01512 01513 //get from storage Vector and add values to it. 01514 batchSqlVec = myConnection.getBatchVector(this); 01515 01516 // If adding parameter for the first time 01517 // create the vector to hold them. 01518 if ( batchSqlVec == null ) 01519 { 01520 batchSqlVec = new Vector(5,10); 01521 01522 storedSize = 0; 01523 } 01524 else 01525 { 01526 storedSize = batchSqlVec.size(); 01527 } 01528 01529 Object[] addBatchParams = arrayParams.getStoredParameterSet(); 01530 int[] addBatchParamsIdx = arrayParams.getStoredIndexSet(); 01531 01532 int batchDataLen = addBatchParams.length; 01533 int batchIdxLen = addBatchParamsIdx.length; 01534 01535 if ( batchIdxLen == numParams ) 01536 { 01537 batchSqlVec.addElement(addBatchParams); 01538 01539 myConnection.setBatchVector(batchSqlVec, this); 01540 01541 arrayParams.storeRowIndex( storedSize, addBatchParamsIdx ); 01542 01543 batchOn = true; 01544 } 01545 else if ( storedSize == 0 ) 01546 { 01547 throw new SQLException("Parameter-Set has missing values."); 01548 } 01549 else 01550 { 01551 //myConnection.setBatchVector(batchSqlVec, this); 01552 batchOn = true; 01553 } 01554 01555 } 01556 catch (NullPointerException e) 01557 { 01558 //throw new SQLException("Parameter Set has missing values"); 01559 batchOn = false; 01560 } 01561 01562 } 01563
------解决方案--------------------
没用过这个数据库。。alter table table_name lock mode row这样么
http://www.cntxk.com/catanews/56/info8355.html