Improve mysql JDBC insert call

Posted by richs on Stack Overflow See other posts from Stack Overflow or by richs
Published on 2010-03-31T21:37:18Z Indexed on 2010/03/31 21:43 UTC
Read the original article Hit count: 407

Filed under:
|
|

i have a legacy Java system that every time it gets an order it makes a JDBC call to a stored procedure for each field in the order. Generally the stored procedure will get called 20 to 30 times for each order. The store procedure is just doing an insert into a table for each field.

i need to improve the performance of this operation. one thought i had was to create an insert query string that does multiple inserts in one JDBC call. MySql supports a multiple insert string.

INSERT INTO PersonAge (name, age)
VALUES  ('Helen', 24),
        ('Katrina', 21),
        ('Samia', 22),
        ('Hui Ling', 25),
        ('Yumie', 29)

This has the advantage of only requiring one JDBC call per order. Any other ideas on how to improve performance?

© Stack Overflow or respective owner

Related posts about java

Related posts about jdbc