A few users have been asking me lately about connecting to DataStax Astra from different developer tools. As a result I am planning to do a series of quick posts around these starting with Intellij DataGrip. Big thank you to Donnie Roberson and Nick Panahi for their help getting the material ready for these posts.
Although I'm a fan of IDEA, Go Land, and GoLion, I confess I had not played with DataGrip until recently. I have found it to be a solid product. The kind of thing you'd expect from our friends at IntelliJ.
I thought DataGrip supported Cassandra out of the box
Yes this is true, there is an Apache Cassandra that ships with DataGrip. However, Astra is secure by default and the easiest way to connect to Astra is to use the secure connect bundle which effortlessly gives us mTLS. For this we need a JDBC driver that is built ontop of a modern version of the DataStax Java driver. Fortunately DataGrip allows us to add custom JDBC drivers with relative ease.
It might be possible to unpack the secure connect bundle and pick out all the pieces needed to configure SSL with the DataGrip cassandra driver but that will be a topic for another day.
Grab and unzip the driver
Next unzip that file in your Downloads directory
Import IDE Settings
Download and import these settings.zip into DataGrip.
**Note**: If you are already a heavy DataGrip user, make sure to back up your existing settings and proceed with caution!
File –> Manage IDE Settings –> Import Settings or simply triple shift – > import settings
At this point you should be able to see a new database connection type called Astra:
If you would rather keep our JDBC jar elsewhere, just remember to change the path under driver files to match where you unziped your jar. By default it will use your user home `/Downloads` directory .
Establish the connection
When you create your connection, URL should look like this:
jdbc:cassandra://;AuthMech=2;UID=<YOUR USER ID>;PWD=<YOUR PASSWORD>;SecureConnectionBundlePath=<PATH TO YOUR SECURE CONNECT BUNDLE>;TunableConsistency=6
At this point you can do things like create tables, introspect your keyspaces, view your data in the DataGrip table explorer and more.