Applications

Connect to CrateDB from database shells and IDEs.

Admin Tools

Learn about the fundamental tools that support working directly with CrateDB.

CrateDB Admin UI

The CrateDB Admin UI
CrateDB Shell

The Crash CLI

Database IDEs

Mostly through its PostgreSQL interface, CrateDB supports working with popular database IDE (Integrated Development Environment) applications.

CrateDB Admin UI

CrateDB ships with a browser-based administration interface called Admin UI.

The Admin UI is enabled on each CrateDB node. You can use it to inspect and interact with the whole CrateDB cluster in various ways.

If CrateDB is running on your workstation, access the Admin UI using http://localhost:4200/. Otherwise, replace localhost with the hostname CrateDB is running on.

When using CrateDB Cloud, open the Admin UI from the Cloud Console using the link shown there (port 4200). The URL typically looks like https://<cluster-name>.<region>.<provider>.cratedb.net:4200/, e.g. https://testdrive.aks1.westeurope.azure.cratedb.net:4200/.

Admin UI SQL console showing a sample SELECT statement Admin UI navigation and overview panel

Note

If you are running CrateDB on a remote machine, you will have to create a dedicated user account for accessing the Admin UI. See User management.

CrateDB Shell

The CrateDB Shell, called crash, is an interactive command-line interface (CLI) program for working with CrateDB on your favorite terminal.

crash default screen after executing a query

Command-line programs

A quick overview about a few CLI programs, and how to use them for connecting to CrateDB clusters. We recommend to use crash, psql, http (HTTPie), or curl.

You can use them to quickly validate HTTP and PostgreSQL connectivity to your database cluster, or to conduct basic scripting.

Before running the command-line snippets outlined below, please use the correct settings instead of the placeholder tokens <hostname>, <username> and <password>.

When using CrateDB Cloud, <hostname> will be something like <clustername>.{aks1,eks1}.region.{azure,aws}.cratedb.net.

crash

image

The CrateDB Shell is an interactive command-line interface (CLI) tool for working with CrateDB. For more information, see the documentation about crash.

CRATEPW=<password> \
    crash --hosts 'https://<hostname>:4200' --username '<username>' \
    --command "SELECT 42.42;"
# No authentication. 
crash --command "SELECT 42.42;"
 

isql

isql and iusql are unixODBC command-line tools allowing users to execute SQL interactively or in batches. The tools provide several useful features, including an option to generate output wrapped in an HTML table.

The PostgreSQL ODBC driver can be used to connect to CrateDB from ODBC environments.

Install and configure the PostgreSQL ODBC driver

While Windows typically includes an ODBC driver manager, you can install the unixODBC driver manager on Linux and macOS systems. The PostgreSQL ODBC driver is called psqlODBC.

Please navigate to the psqlODBC download site to download and install the latest psqlODBC driver for Windows systems. Installing PostgreSQL ODBC drivers on Windows includes an illustrated walkthrough.

On Linux, install the unixODBC ODBC driver manager and the psqlODBC driver. Installing PostgreSQL ODBC drivers on Linux includes an illustrated walkthrough.

Arch Linux

pacman -Sy psqlodbc

Debian and derivatives

apt install --yes odbc-postgresql odbcinst unixodbc

Red Hat and derivatives

yum install -y postgresql-odbc

Verify installation.

odbcinst -q -d
[PostgreSQL ANSI]
[PostgreSQL Unicode]

On macOS, install the unixODBC ODBC driver manager and the psqlODBC driver, then register it.

# macOS
brew install psqlodbc unixodbc

odbcinst.ini

[PostgreSQL Unicode]
Description     = PostgreSQL ODBC driver (Unicode version)
Driver          = /usr/local/lib/psqlodbcw.so
odbcinst -i -d -f odbcinst.ini

Verify installation.

odbcinst -q -d
[PostgreSQL Unicode]
[CrateDB Cloud]
Driver      = PostgreSQL ODBC
Servername  = testcluster.cratedb.net
Port        = 5432
Sslmode     = require
Username    = admin
Password    = password
echo "SELECT 42.42" | iusql "CrateDB Cloud"
[CrateDB]
Driver      = PostgreSQL ODBC
Servername  = localhost
Port        = 5432
Sslmode     = disable
Username    = crate
Password    = crate
echo "SELECT 42.42" | iusql "CrateDB"

psql

image

psql is a terminal-based front-end to PostgreSQL. It enables you to type in queries interactively, issue them to PostgreSQL, and see the query results. For more information, see the documentation about psql.

PGUSER=<username> PGPASSWORD=<password> \
    psql postgresql://<hostname>/crate --command "SELECT 42.42;"
# No authentication.
psql postgresql://crate@localhost:5432/crate --command "SELECT 42.42;"

HTTPie

image

The HTTPie CLI is a modern, user-friendly command-line HTTP client with JSON support, colors, sessions, downloads, plugins & more. For more information, see the documentation about HTTPie.

http "https://<username>:<password>@<hostname>:4200/_sql?pretty" \
    stmt="SELECT 42.42;"
http "localhost:4200/_sql?pretty" \
    stmt="SELECT 42.42;"

curl

image

The venerable curl is the ubiquitous command line tool and library for transferring data with URLs. For more information, see the documentation about curl.

This example combines it with jq, a lightweight and flexible command-line JSON processor.

echo '{"stmt": "SELECT 42.42;"}' \
    | curl "https://<username>:<password>@<hostname>:4200/_sql?pretty" --silent --data @- | jq
echo '{"stmt": "SELECT 42.42;"}' \
    | curl "localhost:4200/_sql?pretty" --silent --data @- | jq