I am trying to insert around 5000 values into the MySql table using Spring JDBC template batch update like it is shown here
http://www.mkyong.com/spring/spring-jdbctemplate-batchupdate-example/
As I understand it is doing as many inserts as many rows I am giving it in one transaction. But it is still slow.
I've tried forming a query like
INSERT INTO CUSTOMER " +
"(CUST_ID, NAME, AGE) VALUES (?, ?, ?), (?, ?, ?), (?, ?, ?),(?, ?, ?)....
for as many rows I have. It performed much faster but I had to form the query manually. I wonder are there any alternatives for batch update for such cases?
P.S. I know that one should consider maximum package size, the query's size should not exceed the limit(though the limit can be configured in MySql server) when building such big queries.
preparedStatement.addBatch(); preparedStatement.executeBatch();? - Xstian