[英]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.我们可以使用 JDBC 将数据读/写到 sql 服务器,但出于某些可扩展性原因(数量和频率),我们希望使用批量复制功能。
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 class。有很多示例,包括从其他表读取和从文件读取,但是没有关于如何插入行数组的示例。
SQLServerBulkCopy has 3 writeToServer methods, which take Rowset, Resultset, and ISQLServerBulkData. SQLServerBulkCopy 有 3 个 writeToServer 方法,它们采用 Rowset、Resultset 和 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 .
JDBC 驱动程序还将使用批量复制 API 进行批量插入操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.