srikotesh
asked on
java.lang.ArrayIndexOutOfBoundsException is coming after jdbc batch executed
Hi Experts,
java.lang.ArrayIndexOutOfB oundsExcep tion is coming after jdbc batch executed
batch size 5000
i have total -5500
batch executed 5000 inserte data successfully
rest of the records failed to execute
if i give batch size 5500
all the date is inserted successfully
refer code here
https://www.experts-exchange.com/questions/29110374/JDBC-Batch-insert-causes-ORA-01000-maximum-open-cursors-exceeded.html
java.lang.ArrayIndexOutOfB
batch size 5000
i have total -5500
batch executed 5000 inserte data successfully
rest of the records failed to execute
if i give batch size 5500
all the date is inserted successfully
refer code here
https://www.experts-exchange.com/questions/29110374/JDBC-Batch-insert-causes-ORA-01000-maximum-open-cursors-exceeded.html
ASKER
Hi Experts,
total records 5527
now i gave batch size as 2000
it is executing perfectly for both conditions.
I didn't understand why it is not working if the batch size as 5000.
Is there any restriction for batchsize?
total records 5527
now i gave batch size as 2000
it is executing perfectly for both conditions.
I didn't understand why it is not working if the batch size as 5000.
Is there any restriction for batchsize?
preStmt.setInt(1, tdmDocumentHdr.getCustId());
preStmt.setString(2,
tdmDocumentHdr.getCountryCode());
preStmt.setDate(3, tdmDocumentHdr.getCreatedDate());
preStmt.setDate(4, tdmDocumentHdr.getModifiedDate());
preStmt.setDate(5, tdmDocumentHdr.getDocDate());
preStmt.addBatch();
if (++insertCount % batchSize == 0) {
logger.debug("inside execute batch insert "
+ insertCount);
preStmt.executeBatch();//executed 2k,4k
}
if (insertCount % batchSize != 0) {
preStmt.executeBatch();//executed rest of the records here successfully
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
How's the status here?
Thanks a lot, I hope, the information will help you ;-)
this
Open in new window
and thisOpen in new window
If you'd set batchSize to 10, then every 10 rows a (batch) insert would occur. But if you have a total > 10 rows, the rest wouldn't be touched because your code just doesn't bother ;-)You'll need to "think" of those, too...