Photo by Toa Heftiba on Unsplash

Adding Cassandra JDBC Driver to DBeaver Community Edition

We all use different editors to use SQL. If you are experiencing a shortage of free editors for Cassandra CQL, you are at the right place. My editor of choice is DBeaver Community Edition. In this edition, MySQL, PostgreSQL, Hive, Spark Thrift, SQLlite, Oracle, and many other database drivers are available. But if you want to use Cassandra and CQL, unfortunately, this is not available. If you don’t want to install a different editor/studio just for Cassandra, I have good news for you. We can add Cassandra JDBC driver to DBeaver Community Edition. In this post, we’ll see how that happens.

Download JDBC Driver Jar

For this, we will use Simba JDBC driver developed by DataStax [1].

Figure-1: Downloading the JDBC Driver

Let’s go to the Downloads folder and unzip the jar file (Figure-2).

Figure-2: Unzip the Driver Jar

Importing JDBC Driver in DBeaver

Run DBeaver. Open Driver Manager from the Database menu (Figure-3).

Figure-3: DBeaver Driver Manager Menu

When you click on Driver Manager above, click the New button in the window that opens, and a new driver definition window will open (Figure-4). Fill in the boxes in this window as in Figure-4.

  • Driver Name: Cassandra
  • Driver Type: Generic
  • Class Name: com.simba.cassandra.jdbc42.Driver
  • URL Template: jdbc:cassandra://{host}[:{port}];AuthMech=0 (set authentication mechanism to 1 if your cluster has authentication enabled)
  • Default Port: 9042
Figure-4: DBeaver Create New Driver Window

You can see the Libraries tab in Figure-4, when we click on it, the window where we can add the driver jar file (Figure-5) will appear. Select Add File(2) -> CassandraJDBC42.jar(3) and click the Open (4) button.

Figure-5: Importing Driver Jar in DBeaver

After completing the above process (Figure-5) and pressing the Ok (4) button, you will see that Cassandra has been added as follows.

Figure-6: Driver Manager Cassandra Attached View

Creating a Cassandra Connection

Now we can create a connection for Cassandra just as we would any database. As we can see in Figure-7, first creating a new connection (1) and then searching for Cassandra in the search box (2) will bring up the Cassandra we defined just above.

Figure-7: New Cassandra Connection

When the Cassandra database in Figure-7 is selected, the window in Figure-8 will open for connection details.

Figure-8: Connection Information

When we click the Test Connection button, if there is a Cassandra listening on 127.0.0.1:9042, we will see that the connection is successful as follows in Figure-9.

Figure-9: DBeaver Connection Test

Running a Cassandra CQL Query

Now we can open a SQL editor page and write CQL commands.

Figure-10: DBeaver Opening New SQL Editor

Let’s start with creating a keyspace

Figure-11: Creating a New Keyspace in CQL

As we can see in Figure-11, we tested it to work successfully.

That’s all in this summer, I wish you pleasant inquiries on Cassandra.

References:

  1. https://downloads.datastax.com/#odbc-jdbc-drivers
  2. https://stackoverflow.com/questions/69027126/how-do-i-connect-to-cassandra-with-dbeaver-community-edition
  3. https://dbeaver.com/docs/wiki/Database-drivers
  4. https://downloads.datastax.com/#odbc-jdbc-drivers
  5. Cover: Photo by Toa Heftiba on Unsplash

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store