cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

DB2 JDBC Connection from Databricks cluster

Karl
New Contributor II

Has anyone successfully connected to a DB2 database on ZOS from a Databricks cluster using a JDBC connection?

I also need to specify an SSL certificate path and not sure if I need to use an init script on the cluster to do so.

Any examples would be very much appreciated.

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions

Ayushi_Suthar
Databricks Employee
Databricks Employee

Hi @Karl , Greetings! 

I've outlined the steps below to connect from Databricks to IBM DB2 using JDBC:

Step 1: Obtain the DB2 JDBC Driver


Step 2: Attach JDBC Driver to Cluster

  • In the Databricks cluster, navigate to the "Libraries" tab.
  • Add the DBFS file path containing the JDBC driver JAR.
  • Install the JAR file to the cluster.


Step 3: Create a Notebook and Connect to IBM DB2

  1. Follow the provided documentation to establish the JDBC connection.
  2. Execute the cell to establish the JDBC connection.
  3. Once connected, execute SQL queries in subsequent cells to interact with the IBM DB2 database.



JDBC URL: jdbc:db2://host-name:50001/BLUDB:sslConnection=true;
Reference Document: IBM DB2 for z/OS JDBC Connectivity Guide

By following these steps, you can establish a JDBC connection from Databricks to your IBM DB2 database and execute SQL queries for data interaction.

Please let me know if this helps and leave a like if this information is useful, followups are appreciated.

Regards,

Ayushi

View solution in original post

1 REPLY 1

Ayushi_Suthar
Databricks Employee
Databricks Employee

Hi @Karl , Greetings! 

I've outlined the steps below to connect from Databricks to IBM DB2 using JDBC:

Step 1: Obtain the DB2 JDBC Driver


Step 2: Attach JDBC Driver to Cluster

  • In the Databricks cluster, navigate to the "Libraries" tab.
  • Add the DBFS file path containing the JDBC driver JAR.
  • Install the JAR file to the cluster.


Step 3: Create a Notebook and Connect to IBM DB2

  1. Follow the provided documentation to establish the JDBC connection.
  2. Execute the cell to establish the JDBC connection.
  3. Once connected, execute SQL queries in subsequent cells to interact with the IBM DB2 database.



JDBC URL: jdbc:db2://host-name:50001/BLUDB:sslConnection=true;
Reference Document: IBM DB2 for z/OS JDBC Connectivity Guide

By following these steps, you can establish a JDBC connection from Databricks to your IBM DB2 database and execute SQL queries for data interaction.

Please let me know if this helps and leave a like if this information is useful, followups are appreciated.

Regards,

Ayushi

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now