简体   繁体   中英

Inserting rows into SQL server using Bulk copy from Spring JDBC

We can read/write data to sql server using JDBC, but for certain scalability reasons (volume & frequency), we want to use the bulk copy functionality.

According to the documentation here , there is a SQLServerBulkCopy class. There are numerous examples, includind reading from other tables, and reading from files, but there is no example on how to insert an array of rows.

SQLServerBulkCopy has 3 writeToServer methods, which take Rowset, Resultset, and ISQLServerBulkData. Is converting our array/list into one of these classes the only way to do a bulk copy? Is there any other way to do it?

Would be glad of any pointers if you've come across this before.

Is converting our array/list into one of these classes the only way to do a bulk copy? Is there any other way to do it?

Yes. The JDBC driver will also use bulk copy API for batch insert operation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM