JDBC: New Connection String Parameters for Java Keystore
Details
| Detail name | Value |
|---|---|
| Changelog Number | 13497 |
| Type | Improvement |
| Status | Resolved |
| Fix Versions | Exasol 7.1.4 |
| Resolution Date | 2021-12-22 |
Background
To use a self-signed certificate in JDBC, the certificate needs to be added to the system default keystore. Then the JDBC driver will automatically load the certificate during the establishment of connection.
Improvement
After creating a new keystore and adding a certificate to the keystore it is now possible to optionally define the keytore, keystore password and keystore type in the connection string.
Parameters
| Property | Values | Default | Description |
|---|---|---|---|
| keystore | String | (Empty) | Specify the keystore file with its location. |
| keystorepassword | String | (Empty) | Provide the keystore password. |
| keystoretype | String | (Empty) | Provide the keystore type. |
Note: Keystore type is optional. When keystore type is not provided, the system default keystore type will be used.
Scenario 1:
Syntax: jdbc:exa:192.168.6.11..14:8563;keystore=<Path To Keystore File>;keystorepassword=<Keystore Password>;keystoretype=<Keystore Type> Example: jdbc:exa:192.168.6.11..14:8563;keystore=/Path/To/Keystore/File;keystorepassword=9dPhkWUQ;keystoretype=jks
Scenario 2:
Syntax: jdbc:exa:192.168.6.11..14:8563;keystore=<Path To Keystore File>;keystorepassword=<Keystore Password> Example: jdbc:exa:192.168.6.11..14:8563;keystore=/Path/To/Keystore/File;keystorepassword=9dPhkWUQ
When the keystore is provided, it is mandatory to provide the keystore password.
If the keystore is provided, and an error occurs in loading the keystore, then the exception will be thrown to the user and connection will not be established.
When the keystore is not provided, then the system default keystore will be used.
Types of Exceptions
1. Keystore password is not provided
com.exasol.jdbc.ConnectFailed: [ERROR] Keystore Error: Keystore password is empty.
2. Keystore Password is incorrect.
com.exasol.jdbc.ConnectFailed: [ERROR] Keystore Error: Keystore was tampered with, or password was incorrect
3. Keystore file is not found.
com.exasol.jdbc.ConnectFailed: [ERROR] Keystore Error: <Keystore filename provided in the string> (No such file or directory) Ex: com.exasol.jdbc.ConnectFailed: [ERROR] Keystore Error: /Path/To/InvalidKeystore/File (No such file or directory)
4. Invalid Keystore Type
com.exasol.jdbc.ConnectFailed: [ERROR] Keystore Error: <Invalid Keystore type provided in the string> not found Ex: com.exasol.jdbc.ConnectFailed: [ERROR] Keystore Error: jksss not found
Changed behavior
New Connection string arguments are introduced in the JDBC driver for loading keystore.