JDBC 插入大批量数据

时不时会有大量数据的插入操作,方式有多种,效率不同:

1. statement

2. prepareStatement

3. statement/prepareStatement + batch

4. 多Value值(单sql语句内写入多了待插入value值)Statement/prepareStatement直接插入

参考如下:

https://www.cnblogs.com/banning/p/6267248.html

https://blog.csdn.net/robinjwong/article/details/45131147

结论大约为:

1. prepareStatement优于statement。

2. 使用batch批量插入优于不使用batch。

3. 多Value值插入效率最佳,但需要注意长度限制。

原文地址:https://www.cnblogs.com/starRebel/p/8715851.html