Little Miss Data

View Original

DB2 SSL Connection in DBeaver

Dbeaver db2 ssl connection


Hello friends. Today’s post is short, sweet and hacky! I’m just going to cover a tip that I recently learned which allows us to create DB2 SSL connections in DBeaver.

Some Background

My current SQL client of choice is DBeaver. I like it because it is free. It has a simple interface and connects to a wide range of different data sources. Some other free SQL clients for Mac that I would recommend include: Sequel Pro, TablePlus and SQquirrel SQL.

Recently I needed to connect to a DB2 database with SSL enabled and I wanted to do it through DBeaver. Unfortunately DBeaver does not currently have the ability to enter SSL information, or a connection string directly in the connection wizard like the other tools listed above.

After lots of searching, I was able to find the hacked answer on the DBeaver GitHub repo, but I wanted to lay it out a little more explicitly for any other folks searching out there.


The Problem

The problem is that in the new connection interface, DBeaver does not have anywhere to enter the SSL info. Even in the advanced settings, it does not connect properly through SSL.

The tool simplifies setting up a connection by taking the host, database and port information in separate input boxes. This is typically a good thing, but in this case it prevents us from being able to enter a URL with all of the necessary SSL information appended at the end.

Example URL with SSL enabled

jdbc:db2://host:port/database:sslConnection=true;sslTrustStorePassword=pswd;sslTrustStoreLocation=/path/file;

The above values should be changed to your actuals: host, port, database, pswd, path/fiile

The Hack

The best way of getting around this is to hijack the database field with the remaining SSL information. Enter your host, port, username and password as you normally would. However, in the Database field, enter the database name, sslConnection=True, sslLocation and password. After you have entered all of the necessary information, press OK and then you can start querying the database!

database:sslConnection=true;sslTrustStoreLocation=/path/file;sslTrustStorePassword=pswd;

Thank You

Thank you for working through this hack with me.  Please comment below or find me on twitter. I would love to hear if you have used this tip, have questions, or would like to see something different in the future. 

Good luck with your SQL exploration!