Skip to content

Commit 023f15a

Browse files
committed
doc: update info about JKS file for SSL Connection
1 parent b7f27c1 commit 023f15a

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

APIDocumentation.md

+16-18
Original file line numberDiff line numberDiff line change
@@ -109,35 +109,30 @@ connStr = "DATABASE=database;HOSTNAME=hostname;PORT=port;Security=SSL;SSLServerC
109109
```
110110
> Note the two extra keywords **Security** and **SSLServerCertificate** used in connection string. `SSLServerCertificate` should point to the SSL Certificate from server or an CA signed certificate. Also, `PORT` must be `SSL` port and not the TCPI/IP port. Make sure Db2 server is configured to accept connection on SSL port else `ibm_db` will throw SQL30081N error.
111111
112-
> `ibm_db` uses IBM ODBC/CLI Driver for connectivity and it do not support a certificate generated in `jks` format.
113-
`ibm_db` do not work with a `keystore.jks` file or any certificate generated for Java application. `ibm_db` works
114-
with a certificate generate for non-Java application that can get processed by GSKit tool. If you have a `*.jks` file,
115-
please get a SSL Certificate meant for non-Java application. If you have downloaded `IBMCertTrustStore` from IBM site,
116-
ibm_db will not work with it; you need to download `Secure Connection Certificates.zip` file that comes for IBM
117-
DB2 Command line tool(CLP).
112+
> Value of `SSLServerCertificate` keyword must be full path of a certificate file generated for client authentication.
113+
It normally has `*.arm` or `*.cert` or `*.pem` extension. `ibm_db` do not support `*.jks` format file as it is not a
114+
certificate file but a Java KeyStore file, extract certificate from it using keytool and then use the cert file.
115+
116+
> `ibm_db` uses IBM ODBC/CLI Driver for connectivity and it do not support a `*.jks` file as keystoredb as `keystore.jks` is meant for Java applications.
117+
Note that `*.jks` file is a `Java Key Store` file and it is not an SSL Certificate file. You can extract SSL certificate from JKS file using below `keytool` command:
118+
```
119+
keytool -exportcert -alias your_certificate_alias -file client_cert.cert -keystore keystore.jks
120+
```
121+
Now, you can use the generated `client_cert.cert` as the value of `SSLServerCertificate` in connection string.
118122

119123
> `ibm_db` supports only ODBC/CLI Driver keywords in connection string: https://www.ibm.com/docs/en/db2/11.5?topic=odbc-cliodbc-configuration-keywords
120124
121125
> Do not use keyworkds like `sslConnection=true` in connection string as it is a JDBC connection keyword and ibm_db
122126
ignores it. Corresponding ibm_db connection keyword for `sslConnection` is `Security` hence, use `Security=SSL;` in
123127
connection string instead.
124128

125-
To connect to dashDB in IBM Cloud, use below connection string:
129+
* To connect to dashDB in IBM Cloud, use below connection string:
126130
```
127131
connStr = "DATABASE=database;HOSTNAME=hostname;PORT=port;PROTOCOL=TCPIP;UID=username;PWD=passwd;Security=SSL";
128132
```
129133
> We just need to add **Security=SSL** in connection string to have a secure connection against Db2 server in IBM Cloud.
130134
131-
To connect a Db2 Server using SSL Certificate file, you can use connection string like below:
132-
```
133-
connStr = "DATABASE=database;HOSTNAME=hostname;PORT=port;PROTOCOL=TCPIP;UID=username;PWD=passwd;" +
134-
"Security=SSL;SSLServerCertificate=/home/user/myclientcert.arm;";
135-
```
136-
> Value of `SSLServerCertificate` keyword must be full path of a certificate generated for non-Java application on
137-
Db2 Server. It normally has `*.arm` or `*.cert` or `*.pem` extension. `ibm_db` do not support `jks` format
138-
certificate file.
139-
140-
You can also create a KeyStore DB using GSKit command line tool and use it in connection string along with other keywords as documented in [DB2 Infocenter](http://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.5.0/com.ibm.db2.luw.admin.sec.doc/doc/t0053518.html).
135+
**Note:** You can also create a KeyStore DB using GSKit command line tool and use it in connection string along with other keywords as documented in [DB2 Infocenter](http://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.5.0/com.ibm.db2.luw.admin.sec.doc/doc/t0053518.html).
141136

142137
If you have created a KeyStore DB using GSKit using password or you have got *.kdb file with *.sth file, use
143138
connection string in below format:
@@ -149,7 +144,10 @@ connStr = "DATABASE=database;HOSTNAME=hostname;PORT=port;PROTOCOL=TCPIP;UID=dbus
149144
"Security=SSL;SslClientKeystoredb=C:/client.kdb;SSLClientKeystoreDBPassword=kdbpasswd;";
150145
```
151146

152-
**Note:** You can also create keystoredb using GSKit and add certificate file to keystoredb to use as documented in [DB2 Infocenter](http://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.5.0/com.ibm.db2.luw.admin.sec.doc/doc/t0053518.html).
147+
> If you have downloaded `IBMCertTrustStore` from IBM site, ibm_db will not work with it; you need to
148+
download `Secure Connection Certificates.zip` file that comes for IBM DB2 Command line tool(CLP).
149+
`Secure Connection Certificates.zip` has *.kdb and *.sth files that should be used as the value of
150+
`SSLClientKeystoreDB` and `SSLClientKeystash` in connection string.
153151

154152
### <a name="openSyncApi"></a> 2) .openSync(connectionString [,options])
155153

0 commit comments

Comments
 (0)