ESP dSeries Workload Automation

 View Only

 SQL Server JDBC driver on dSeries server

Kevin Cornell's profile image
Kevin Cornell posted Jan 23, 2025 10:55 AM

We are attempting to connect to a SQL Server database using JDBC in a job's JavaScript in the "at run time" event.

Doing this with an Oracle database is relatively straightforward because the Oracle JDBC drivers ship with the JDK/JRE, since Oracle owns it. This works fine in our environment. For SQL Server, an external JAR needs to be installed.

These JavaScripts end up executing on the server, not the agent assigned to the job. Here is the offending line of JavaScript, and the error from server's errors.log file, connection information redacted:

JavaScript excerpt:

var sqlCon = java.sql.DriverManager.getConnection('jdbc:sqlserver://(server);encrypt=true;databaseName=(database);integratedSecurity=true;', APPL.DBUSER, APPL.DBPASS);

Error:

JavaScript could not be executed. The reason is: java.util.concurrent.ExecutionException: org.mozilla.javascript.WrappedException: Wrapped java.sql.SQLException: No suitable driver found for jdbc:sqlserver://(server);encrypt=true;databaseName=(database);integratedSecurity=true; (<wascope>#2)

We have tried putting Microsoft's JAR containing the driver in various lib folders under the server, but no luck. Does anyone have an example to connect to SQL Server via JDBC, or getting the server to recognize any external JAR in JavaScript for that matter?

Ravi Kiran Kunduri's profile image
Broadcom Employee Ravi Kiran Kunduri

Hi,

Javascripts execute at server side only. If you want to run any queries , can you please make use of SQL job type - https://techdocs.broadcom.com/us/en/ca-enterprise-software/intelligent-automation/ca-workload-automation-de/12-4/scheduling/job-types/database-jobs/define-an-sql-job.html

Hope it helps!

Ravi Kiran