cassandra-jdbc-driver
cassandra-jdbc-driver copied to clipboard
Cassandra JDBC Driver | DbSchema Cassandra Management GUI
Cassandra JDBC Driver | DbSchema Cassandra Designer
This is an open source JDBC Driver for Cassandra. The driver is provided and used by DbSchema Cassandra GUI Tool. The code is using few improvements done to the original code by DataGrip.
Licensing
GPL-3 dual license. The driver is free to use by everyone. Code modifications allowed only to the current repository as pull requests https://github.com/wise-coders/cassandra-jdbc-driver
Features
- Connect to Cassandra using the same JDBC URL as the native Cassandra Java driver
- Execute native Cql queries
- Implement of DatabaseMetaData methods for getting table, columns and index structure
Downloading the Driver Binaries
Available here. Unpack and include all jars in your classpath.
How to Configure the JDBC Driver
- Java Driver Class: CassandraJdbcDriver
- JDBC URL: jdbc:cassandra://host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[keyspace];dataCenter[&options]]
- Website: DbSchema
Make sure your password don't have any ampersand character (&
), since it is part of the parameters' delimiter.
If it is not possible, set your password by using a Properties object.
Find the DataCenter using 'nodetool status' or 'nodetool -h ::FFFF:127.0.0.1 status'.
The driver we wrote on top of the native Cassandra Java Driver
Using a File to Configure Your Driver
You can configure your driver using a file by passing using the configfile
parameter and the path to file, like this:
configfile=/path/to/file.conf
Please, refer to DataStax Driver Configuration Reference to know all possible parameters.
Connecting using SSL
For this set this URL parameters:
javax.net.ssl.trustStore=/path/to/client.truststore&javax.net.ssl.trustStorePassword=password123&
If you're using client authentication:
javax.net.ssl.keyStore=/path/to/client.keystore&javax.net.ssl.keyStorePassword=password123
This parameters can be also set in DbSchema.vmoptions file like :
-Djavax.net.ssl.trustStore=/path/to/client.truststore
-Djavax.net.ssl.trustStorePassword=password123
If you're using client authentication:
-Djavax.net.ssl.keyStore=/path/to/client.keystore
-Djavax.net.ssl.keyStorePassword=password123
Retrieving your Password from an AWS Secrets Entry
You can to retrieve your password from AWS Secrets by passing these parameters:
-
awsregion
: The region which your secret was stored in; -
awssecretname
: The name of the secret were is your password stored in. -
awssecretkey
: The key of the secret used to get a password from your secret.
To authenticate in AWS, the driver uses the DefaultCredentialsProviderChain. To know more about it, refer to AWS DefaultCredentialsProvider documentation.
Connecting to AWS Keyspaces
You can connect to AWS Keyspaces by using this JDBC URI example:
jdbc:cassandra://<aws_keyspaces_endpoint>:9142/<default_keyspaces>?dc=<aws_region>&javax.net.ssl.trustStore=/path/to/client.truststore&javax.net.ssl.trustStorePassword=password123
Click here to know more about AWS Keyspaces Service Endpoints.
Connect using Kerberos
add the parameter kerberos=true to the JDBC URL. This will add the (Kerberos Authentication Driver)[https://github.com/instaclustr/cassandra-java-driver-kerberos].
How to Test the Driver
The driver can be tested by simply by downloading DbSchema. The tool can be evaluated 15 days for free.
DbSchema already include the Cassandra JDBC driver. You can simply connect to Cassandra and reverse engineer the schema.
Using the second tab you can enter a custom URL.
DbSchema can reverse engineer the schema and represent it as diagrams.
The Query Editor can be used for executing Cql Queries:
DbSchema can create virtual foreign keys, which are saved to project file. They can be used in Relational Data Browse, to simply explore data from multiple tables.
Also a random data generator for Cassandra is available: