user22554263
user22554263

Reputation: 31

DBeaver Community Edition - No Driver for Apache Cassandra on Mac

I am a Mac user attempting to set up DBeaver to connect to Cassandra DB. https://downloads.datastax.com/#odbc-jdbc-drivers has no Mac version for Apache Cassandra to download. Any solutions or alternative Cassandra DB tools available for Mac devices?

Installed DBeaver Community Edition. But no Cassandra driver comes with it.

Upvotes: 2

Views: 1854

Answers (1)

clunven
clunven

Reputation: 1685

You can totally leverage the ING JDBC Cassandra driver to plug DBeaver on a Cassandra node.

Step by Step instructions

1. Start Cassandra Locally

Assuming you are running Cassandra locally with Docker

docker run --name cassandra \
-p 9042:9042 \
-d cassandra:4.1.3

2. Setup Cassandra

After about 30s, Cassandra should be started. To connect with DBeaver and the Cassandra JDBC you need to provide the keyspace so let us create one named stackoverflow

  • Access the cqlsh console:
docker exec -it cassandra bash -c "cqlsh"
  • Get your datacenter name (default is datacenter1) it will also be needed in the JDBC url.
select data_center from system.local;
  • Create a few things : keyspace and table
CREATE KEYSPACE IF NOT EXISTS stackoverflow 
WITH REPLICATION = { 
  'class':'SimpleStrategy', 
  'replication_factor':1
 };
use stackoverflow;
CREATE TABLE IF NOT EXISTS countries (code TEXT PRIMARY KEY, name TEXT);
INSERT INTO countries(code, name) VALUES('fr', 'France');
INSERT INTO countries(code, name) VALUES('uk', 'United Kingdom');
INSERT INTO countries(code, name) VALUES('usa', 'United States');
select * from countries;

3. Download DBeaver

Go the DBeaver download page or Dbearver lite and pick the proper DMG either your are on intel or apple silicon (M1, M2) enter image description here

4. Download the JDBC driver

  • Go the release github page of ING JDBC Driver

  • Pick the latest release. in Assets, downloads the file cassandra-jdbc-wrapper-x.Y.Z-bundle.jar in your Documents folder.

5. Create DBeaver Driver

  • Open DBeaver application

  • In the menu go Database > Driver manager

  • The Panel Click new without selecting anything

enter image description here

  • There, choose the TAB libraries and select Add File, look for the jar we just downloaded.

enter image description here

  • Go back to the tab Settings and enter the following values:
Var Value
Driver Name cassandra-ing-driver
Driver Type generic
ClassName com.ing.data.cassandra.jdbc.CassandraDriver

enter image description here

  • Save your modifications with [OK]

6. Create the Datasource

  • In the menu now select Database > New Database Collection

  • Pick the driver cassandra-ing

enter image description here

  • Populate the URL as follow:
jdbc:cassandra://127.0.0.1:9042/stackoverflow?localdatacenter=datacenter1
  • Click Test Connection

enter image description here

  • Validate and Save

  • On the left panel you can now see your data

enter image description here

Upvotes: 9

Related Questions