IBM DB2 migrating from ODBC to JDBC.
While ODBC connections have been working fine, we are unable to find a working solution for JDBC connection through JMP 19.
Classpath has been defined for JDBC driver.
But still gives error that it failed to load Driver.
Appreciate, if someone can share working solution.
// Ensure you have the IBM Db2 JDBC driver JAR (db2jcc4.jar) in JMP's Java classpath
// You can get it from IBM's Db2 installation or download from IBM Fix Central
// JDBC connection parameters for IBM Db2
dbDriver = "com.ibm.db2.jcc.DB2Driver";
dbURL = "jdbc:db2://db2.exampleURL.com:50001/isdw:sslConnection=true;sslVersion=TLSv1.2;"; // Replace with your host, port, and DB name
dbUser = "username"; // Replace with your Db2 username
dbPass = "mypassword"; // Replace with your Db2 password
// Load the JDBC driver
Try(
Java Open( dbDriver ),
Throw( "Failed to load JDBC driver: " || dbDriver )
);
// Open the database connection
conn = Open Database(
"Driver=JDBC:" || dbDriver || ";URL=" || dbURL || ";UID=" || dbUser || ";PWD=" || dbPass
);
// Check if connection succeeded
If( Is Empty( conn ),
Throw( "Database connection failed." )
);
// SQL query example
sqlQuery = "select lot_id,
............ example SQL query that has been working in ODBC................
order by lot_Id, wafer_Id, parm_Label, level
WITH UR
;
";
// Execute query and load into JMP data table
dt = Execute SQL( conn, sqlQuery );
// Close the connection
Close Database( conn );
// Show the data table if results exist
If( !Is Empty( dt ),
dt << Show Window,
Print( "No data returned from query." )
);

