I recently ran into an issue where doing a large number of inserts and updates in an Oracle 8i database was taking forever. I was already using a prepared statement and commiting only after a certain number of rows. After some digging I found out that there is a special Oracle way of doing batch updates that made things a good bit faster. They do support the normal addBatch batch updates but it isn't as fast as using their special way.
Here is an example of how to do things their way:
// You have to turn auto commit off, if you are doing a large set of inserts and updates you are probably doing this already.
PreparedStatement preparedStatement = connection.prepareStatement("insert into a_table(a_col) values (?)");
// This is the magic. Set the number of statements to allow in one batch
int count = 0;
for(Iterator i=aLargeList.iterator(); i.hasNext(); count++)
YourData yourData = (YourData)i.next();
if(count % 10 == 0)
// Send all currently queued statements
For more information see the following link: