AnsweredAssumed Answered

Cannot get Groovy script to instantiate database driver: Error ClassNotFoundException

Question asked by jturner2939930 on Nov 8, 2016
Latest reply on Dec 13, 2016 by Sjaak Overgaauw

We have a Groovy script built to call a stored procedure in a DB2 (AS400) database.  The code cannot instantiate the driver class on the atom when executing the script.  A run time exception is thrown on this line: Class.forName("").  We have a standard database connector that uses the same class and connection string that works fine but the script does not work.  I suspect that it cannot find the Jar file which is located under <atom install dir>/userlib/database/.  Does the Jar file need to be in a different place for the script to load it, and if so where?


Exception throw is of type ClassNotFoundException with a value of "".


import com.boomi.execution.ExecutionUtil;
import java.util.logging.Logger;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;

String message = "";
Connection conn = null;
CallableStatement stmt = null;
ResultSet rs = null;

// Retrieve a handle to the Logger
Logger logger = ExecutionUtil.getBaseLogger();

try {

// Connect to iSeries
logger.fine("About to validate the driver class name");

// Exception thrown on above line and cannot load the driver class of code