Use CrateDB With DataGrip, an Advanced Database IDE

2018-09-25, by Naomi Slater

DataGrip is a cross-platform database IDE that is tailored to suit the specific needs of professional SQL developers.

With the help of the CrateDB JDBC driver, you can use DataGrip with CrateDB.

In this post, I will show you how to get set up with CrateDB and DataGrip as a desktop client for macOS, but these instructions should be trivially adaptable for Linux or Windows.

Install CrateDB

If you don't already have CrateDB running locally, it's very easy to get set up.

Run this command:

$ bash -c "$(curl -L try.crate.io)"

This command just downloads CrateDB and runs it from the tarball. If you'd like to actually install CrateDB a bit more permanently, or you are using Windows, check out our collection of super easy one-step install guides.

If you're using the command above, it should pop open the CrateDB admin UI for you automatically once it has finished. Otherwise, head over to http://localhost:4200/ in your browser.

You should see something like this:

Get Some Data

If you’re playing around with a fresh CrateDB install, chances are you don't have any data. So head on over to the Help screen by selecting the question mark icon on the left-hand navigation menu.

The help screen looks like this:

Select IMPORT TWEETS FOR TESTING and follow the instructions to authenticate your Twitter account.

Don't worry. This isn’t going to post anything on your behalf. It doesn’t even look at your tweets. All this does is import a bunch of recent public tweets on Twitter.

Once you're done, select the Tables icon from the left-hand navigation, and then select the tweets table. You should end up here:

http://localhost:4200/#/tables/doc/tweets

Which should look like this:

Get DataGrip Running

Head on over to the DataGrip page and select Download to start your trial.

I'm using macOS, so once the download completed, I dragged the application icon to my Applications folder.

When you open DataGrip for the first time, you will be prompted to import settings, and then you will be prompted to activate the software. For now, you can select Evaluate for free and then Evaluate.

After being prompted to configure some initial settings, you should see something like this:

Install the CrateDB Driver

DataGrip does not come with a bundled CrateDB driver. But you can install one pretty easily.

Firstly, download the latest CrateDB JDBC standalone JAR.

Now, select the Database tab from the left-hand side. You should see a side-panel open up, like this:

Then, select the plus icon, then Driver, like so:

The following screen should come up:

From here:

  1. Name the driver "CrateDB"
  2. Use the plus icon for the Driver files section to add the CrateDB JDBC standalone JAR file you previously downloaded
  3. Select the appropriate class name from the Class dropdown menu, which should be prepopulated

You should end up with something that looks like this:

Select OK.

Connect to CrateDB

Now, you can add a CrateDB data source:

On the screen that comes up, configure the data source like so:

  • Name: CrateDB
  • User: crate
  • URL: jdbc:crate://localhost:5432/

Like so:

Select OK.

Then, from the following screen, expand the "CrateDB" database and you should be able to see the tweets table:

From here, you can select the tweets table, and then select the Data Editor icon (the table icon towards the top left-hand side of the user interface) to bring up a view of the table, like so:

And from here, you can continue to explore the features of DataGrip.

Wrap Up

If you're looking for a fully-featured database IDE that works with CrateDB, DataGrip provides the goods. Explore your database, write queries using a powerful query interface, run queries, import and export data, and much more.

Don't forget to check out the other clients that work with CrateDB.