Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Whats the best way, in terms of performance, to do multiple insert/update statements, a PreparedStatement or Batch Updates?

0
Posted

Whats the best way, in terms of performance, to do multiple insert/update statements, a PreparedStatement or Batch Updates?

0

Location: http://www.jguru.com/faq/view.jsp?EID=448102 Created: Jun 30, 2001 Author: Aron Tunzi (http://www.jguru.com/guru/viewbio.jsp?EID=446077) Question originally posed by Jorge Jordão (http://www.jguru.com/guru/viewbio.jsp?EID=275762 Because PreparedStatement objects are precompiled, their execution can be faster than that of Statement objects. Consequently, an SQL statement that is executed many times is often created as a PreparedStatement object to increase efficiency. A CallableStatement object provides a way to call stored procedures in a standard manner for all DBMSes. Their execution can be faster than that of PreparedStatement object. Batch updates are used when you want to execute multiple statements together. Actually, there is no conflict here. While it depends on the driver/DBMS engine as to whether or not you will get an actual performance benefit from batch updates, Statement, PreparedStatement, and CallableStatement can all execute the addBatch() method. See section

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123