Notes on batch processing in Java

When batch processing, a large amount of data is
best to use addbatch, executebatch statement for batch processing.
If you use executeUpdate, it is not impossible, but the efficiency is too low. It
requires one command to transmit to the database. A lot of time is wasted in database transmission. In the process of commands,
addbatch is used, which loads a large number of commands into the command line of Statement first, and then transmits them to the database at a time, allowing the database to execute these commands at one time, which greatly improves efficiency.

It is best to use Statement to call addbatch. Preparedment is not impossible, but it needs to be pre-compiled. When a large number of commands are encountered, some exceptions may occur.

Guess you like

Origin blog.csdn.net/qq_43665244/article/details/108853904