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.
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
- 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
Available here. Unpack and include all jars in your classpath.
- 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
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.
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
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.
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.
add the parameter kerberos=true to the JDBC URL. This will add the (Kerberos Authentication Driver)[https://github.com/instaclustr/cassandra-java-driver-kerberos].
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: