Configuring TLS Support in a non-Java Db2 client using a certificate file
You can configure Db2 database clients, such as CLI, CLP, and .Net Data Provider clients, to support Transport Layer Security (TLS) for communication with the Db2 server.
About this task
This task shows you how to configure TLS support in a non-Java Db2® client using the signing certificate only. To configure TLS support using a key database, see Configuring TLS Support in a non-Java Db2 client using a keystore
Procedure
Example
Example 1: Connecting to a database from a CLI/ODBC application, using a connection string:
"Database=sampledb; Protocol=tcpip; Hostname=myhost; Servicename=50001;
Security=ssl; SSLServerCertificate=/home/db2inst1/servercert.pem;"
Example 2: Connecting to a database from a CLI/ODBC application, using a db2cli.ini configuration file:
[sampledb]
Database=sampledb
Protocol=tcpip
Hostname=myhost
Servicename=50001
Security=ssl
SSLServerCertificate=/home/db2inst1/servercert.pem
Example 3: Connecting to a database from a CLI/ODBC application, using the SQLDriverConnect function (CLI):
Use the FileDSN CLI/ODBC keyword to identify a DSN file from which a connection string is built for connecting to the Db2 server. You specify the value of FileDSN in the connection string of the SQLDriverConnect function.
[ODBC]
DRIVER=IBM DB2 ODBC DRIVER – DB2COPY1
UID=user1
AUTHENTICATION=SERVER
PORT=50001
HOSTNAME=myhost
PROTOCOL=TCPIP
DATABASE=SAMPLEDB
SECURITY=SSL
SSLServerCertificate=/home/db2inst1/servercert.pem
Example 4: Connecting to a database from a CLI/ODBC application or embedded SQL application, using the db2dsdriver.cfg configuration file.
If you are running Db2 11.5.7 or later, you can include the SSLServerCertificate keyword in the db2dsdriver.cfg configuration file to connect from an embedded SQL application.
<dsn alias="sample" host="myhost.ibm.com" name="sample" port="50001">
<parameter name="SSLServerCertificate" value="/home/db2inst1/servercert.pem"/>
<parameter name="SecurityTransportMode" value="SSL"/>
</dsn>