Change Bulk Copy API for batch insert to respect the timeout value
Fix | setQueryTimeout doesn't work when performing bulk copy to Azure Data Warehouse
@@ -2003,6 +2003,9 @@ public class SQLServerPreparedStatement extends SQLServerStatement implements IS
}
SQLServerBulkCopy bcOperation = new SQLServerBulkCopy(connection);
+ SQLServerBulkCopyOptions option = new SQLServerBulkCopyOptions();
+ option.setBulkCopyTimeout(queryTimeout);
+ bcOperation.setBulkCopyOptions(option);
bcOperation.setDestinationTableName(tableName);
bcOperation.setStmtColumnEncriptionSetting(this.getStmtColumnEncriptionSetting());
bcOperation.setDestinationTableMetadata(rs);
@@ -2157,6 +2160,9 @@ public class SQLServerPreparedStatement extends SQLServerStatement implements IS
}
SQLServerBulkCopy bcOperation = new SQLServerBulkCopy(connection);
+ SQLServerBulkCopyOptions option = new SQLServerBulkCopyOptions();
+ option.setBulkCopyTimeout(queryTimeout);
+ bcOperation.setBulkCopyOptions(option);
bcOperation.setDestinationTableName(tableName);
bcOperation.setStmtColumnEncriptionSetting(this.getStmtColumnEncriptionSetting());
bcOperation.setDestinationTableMetadata(rs);
