Pentaho

 View Only

 SQL Server JDBC Bulk Copy works on Windows, fails on Linux

John Craig's profile image
John Craig posted 04-03-2023 07:45

Hi Folks,

Any suggestions? I have created a User-defined Java Class step that calls some external Java code to do a bulk copy using the mssql-jdbc-12.2.0.jre8.jar version of the SQL Server JDBC driver's com.microsoft.sqlserver.jdbc.SQLServerBulkCopy class.

It works without any issues on Windows environments running Pentaho 9.3 or 9.0.0.7.

But, when I run it on a Linux environment (CentOS 8, Java 8, Pentaho 9.0.0.7), it fails with this rather confusing error message sequence (my code writes to the log the JDBC connection information before trying to invoke the SQLServerBulkCopy.writeToServer method):

2023/03/31 16:32:44 - srcDatabase: OLTP
2023/03/31 16:32:44 - srcConnection: jdbc:sqlserver://usdv01grsql01:1433;<snip>;databaseName=OLTP;<snip>, UserName=OLTPReader, Microsoft JDBC Driver 12.2 for SQL Server
2023/03/31 16:32:44 - destDatabase getObjectName()PentahoDW
2023/03/31 16:32:44 - destConnection: jdbc:sqlserver://usdv01grsql01:1433;<snip>;UserName=DWWriter, Microsoft JDBC Driver 12.2 for SQL Server
2023/03/31 16:32:44 - Do MS SQL Bulk Load.0 - ERROR (version 9.0.0.7-758, build 9.0.0.7-758 from 2020-09-24 04.31.14 by buildguy) : Unexpected error
2023/03/31 16:32:44 - Do MS SQL Bulk Load.0 - ERROR (version 9.0.0.7-758, build 9.0.0.7-758 from 2020-09-24 04.31.14 by buildguy) : org.pentaho.di.core.exception.KettleException:
2023/03/31 16:32:44 - Do MS SQL Bulk Load.0 - com.microsoft.sqlserver.jdbc.SQLServerException: Destination connection must be a connection from the Microsoft JDBC Driver for SQL Server.

Note that destConnection is an instance of jdbc:sqlserver:// ... Microsoft JDBC Driver 12.2 for SQL Server. So, why the exception?

If anyone has any ideas about why this is not working, I'd be grateful to hear them.

John

Petr Prochazka's profile image
Petr Prochazka

Hi John,
could you provide full stacktrace of error?

Do you use pooled connection or direct instance of connection? How do you have defined connection in kettle?