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.
-
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.
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.
- Add or edit a Db2 connection.
- In the General tab, specify the secure port in the Port field.
-
In the Optional tab, specify the JDBC properties for a secure connection.
At a minimum, you’ll need the following properties:
sslConnection
totrue
- One of the following set of properties to specify the Db2 server certificate location:
sslCertLocation
sslTrustStoreLocation
andsslTrustStorePassword
sslTrustStoreLocation
,sslTrustStorePassword
(optional), andsslTrustStoreType
If you’re using the Java KeyStore to store the client certificate, you’ll need to add the following properties:
securityMechanism
set to18
- One of the following set of properties to specify the client certificate location:
sslKeyStoreLocation
andsslKeyStorePassword
sslKeyStoreLocation
andsslKeyStorePassword
(optional), andsslKeyStoreType
The following example shows the properties for using the Java truststore and Java KeyStore.
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 to7
and set theencryptionAlgorithm
property to the appropriate value for your environment. - For encrypted user ID and encrypted password security, set the
securityMechanism
property to9
and set theencryptionAlgorithm
property to the appropriate value for your environment.
- 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.