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.