The best way to continue to insert a large amount of data via JDBC. Batch insert or stored procedure?

advertisements

I'm using Spring connecting to Sql Server 2008 R2 via JDBC.

All I need is to insert a large amount of data to a table in the database as fast as possible. I'm wondering which way is better:

  1. Use Spring batch insert mention here

  2. Create stored procedure in database and call it on Java side

Which one is better?


It depends on two things stored producer would take up the database time where as batch would take up time on the program side. so depending on what you are more concerned with it is really up to up. Me i would prefer the batch as to keep the database time free reducing errors that might occur. Hope this helps!