Creating a database connection

Before you can run your SQL, you need to connect to the Db2 for z/OS subsystem that contains the database that you want to work with. You can use Db2 Developer Extension’s integrated database connection capability to add a connection.

From the DB2 for Z/OS CONNECTIONS view, click the plus sign (+) to open the Add Db2 Connection dialog.

Adding a database connection

  • Use the General tab to specify basic connection information about the Db2 subsystem and valid user credentials for connecting to that Db2 subsystem.

  • If you run into problems when you define a new connection or when you run your SQL against an existing connection, and those problems are related to the data server driver, open the Tracing tab and turn Enable driver trace to On. See Opening an issue and providing logs for more information about the logs that are produced when you enable tracing.

  • If you want to include additional properties in your database connection, open the Optional tab and enter the property name and assign it a value. Select the checkbox to the left of a property to include it in a database connection. Click the blue plus sign (+) to add a new line.

  • Use the Tuning tab to specify a SQL Tuning Services server and to associate a tuning connection profile with a Db2 connection. See Setting up an SQL Tuning Services environment for more information.

When you’re done, click Finish. If your database connection was created successfully, it’ll be added to the DB2 FOR Z/OS CONNECTIONS view.

If your database connection fails to establish a connection, open the Tracing tab, enable tracing, and try to connect again. Then, check the logs for more information about why the connection failed to connect.

Changing a connection name

When you create a connection, a connection name is automatically generated based on the connection information. You can change this name by editing the connection and changing the Connection name field.

Connecting with multi-factor authentication

When you select MFA token as the login method, use the IBM Verify app to generate an MFA token and specify that token in the MFA token field.

Using multi-factor authentication

Important: To reduce timeout issues with MFA tokens, make sure that the following Db2 for z/OS subsystem parameters are set appropriately. For example:

MFA_AUTHCACHE_UNUSED_TIME=120
AUTHEXIT_CACHEREFRESH=ALL

Connecting with SSL/TLS

Before you can use SSL/TLS to connect to a Db2 server, the Db2 server must be configured for SSL/TLS. If you’re not sure if the Db2 server has been configured for SSL/TLS, check with your network administrator.

  1. Add or edit a Db2 connection.
  2. In the General tab, specify the secure port in the Port field.
  3. In the Optional tab, specify the JDBC properties for a secure connection.

    At a minimum, you’ll need the following properties:

    • sslConnection to true
    • One of the following set of properties to specify the Db2 server certificate location:
      • sslCertLocation
      • sslTrustStoreLocation and sslTrustStorePassword
      • sslTrustStoreLocation, sslTrustStorePassword (optional), and sslTrustStoreType

    If you’re using the Java KeyStore to store the client certificate, you’ll need to add the following properties:

    • securityMechanism set to 18
      • One of the following set of properties to specify the client certificate location:
      • sslKeyStoreLocation and sslKeyStorePassword
      • sslKeyStoreLocation and sslKeyStorePassword (optional), and sslKeyStoreType

    The following example shows the properties for using the Java truststore and Java KeyStore.

    Java truststore and Java KeyStore properties

    If you’re using encrypted password security (security mechanism 7) or encrypted user ID and encrypted password security (security mechanism 9), you’ll need one of the following set of properties:

    • For encrypted password security, set the securityMechanism property to 7 and set the encryptionAlgorithm property to the appropriate value for your environment.
    • For encrypted user ID and encrypted password security, set the securityMechanism property to 9 and set the encryptionAlgorithm property to the appropriate value for your environment.
  4. Click Finish to establish an SSL connection to the Db2 server.

For more information, see Configuring connections under the IBM Data Server Driver for JDBC and SQLJ to use SSL.