cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
] />

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar

JMP 19 to connect to JDBC IBM DB2

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." ) );

image.png

image.png

4 REPLIES 4
jthi
Super User

Re: JMP 19 to connect to JDBC IBM DB2

Your code looks LLM generated and they aren't generally that good with JSL. Have you tried to use JMPs Query Builder to make the query first time? After that you can easily get the script for that (New SQL Query())

image.png

Using JMP > Import Your Data > Build SQL Queries in Query Builder 

-Jarmo

Re: JMP 19 to connect to JDBC IBM DB2

1) JMP Query Builder is going directly into Open Data File dialog box.

2) Alternatively tried File --> Connect To --> Data Connections

image.png

 

However, it only shows existing ODBC connections or lets create new ODBC connections only. No JDBC connection option.

 

Re: JMP 19 to connect to JDBC IBM DB2

Does JMP only support ODBC connections only and not JDBC?

Re: JMP 19 to connect to JDBC IBM DB2

JMP does not support JDBC. It is possible to use Python connections to JDBC brokers for this purpose. Of course, you'll have to have Java installed on any machines you deploy to.

Regards,

 

Brian Corcoran

JMP Development

Recommended Articles