Connecting programmatically with JDBC

Define a connection between a Java™ application and the Db2 database, BLUDB.

Before you begin

Before you can connect to your database, you must carry out the following steps:
  • Verify prerequisites, including installing driver packages, configuring your local environment, and downloading SSL certificates (if needed)

  • Collect connect information, including database details such as host name and port numbers, and connect credentials such as user ID and password


In each Java application, specify the user ID and password by including the DriverManager.getConnection method, and then include one of the following JDBC URL strings:
  • For a connection without SSL:
  • For a connection with SSL: