Using SQLLine With Apache Ignite | Ignite Documentation

Ignite Summit 2023 — Watch on demand — Register now!


Using SQLLine With Apache Ignite

Command line tool for SQL connectivity.


Apache Ignite is shipped with the SQLLine tool – a console-based utility for connecting to relational databases and executing SQL commands. This documentation describes how to connect SQLLine to your cluster, as well as various supported SQLLine commands.

Connecting to Ignite Cluster

From your {IGNITE_HOME}/bin directory, run -u jdbc:ignite:thin:[host] to connect SQLLine to the cluster. Substitute [host] with your actual value. For example:

./ --verbose=true -u jdbc:ignite:thin://
sqlline.bat --verbose=true -u jdbc:ignite:thin://

Use the -h or help option to see the various options available with SQLLine:

./ -h
./ --help
sqlline.bat -h
sqlline.bat --help


If you have authentication enabled for your cluster, then from your {IGNITE_HOME}/bin' directory, run `jdbc:ignite:thin://[address]:[port];user=[username];password=[password] to connect SQLLine to the cluster. Substitute [address], [port], [username] and [password] with your actual values. For example:

./ --verbose=true -u "jdbc:ignite:thin://;user=ignite;password=ignite"
sqlline.bat --verbose=true -u "jdbc:ignite:thin://;user=ignite;password=ignite"

If you do not have authentication set, omit [username] and [password].


Put JDBC URL in Quotes When Connecting from bash

Make sure to put the connection URL in " " quotes when connecting from a bash environment, as follows: "jdbc:ignite:thin://[address]:[port];user=[username];password=[password]"


Here is the list of supported SQLLine commands:

Command Description


Execute the specified SQL against all the current connections.


Start or execute a batch of SQL statements.


Enable terse output mode.


Close all current open connections.


Display columns of a table.


Connect to a database.


List metadata information about the current connection.


Drop all tables in the database.


Change to a different active connection.


Display help information.


Display the command history.


Display indexes for a table.


Display all active connections.


Display SQLLine manual.


Invoke arbitrary metadata commands.


Create a friendly name for the connection (updates command prompt).


Change the method for displaying SQL results.


Display the primary key columns for a table.


Connect to the database defined in the specified properties file.


Exit SQLLine.


Reconnect to the current database.


Begin recording all output from SQL commands.


Execute a command script.


Save executed commands to a file.


Execute a SQL against a database.


List all the tables in the database.


Enable verbose output mode.

Note that the above list may not be complete. Support for additional SQLLine commands can be added.


After connecting to the cluster, you can execute SQL statements and SQLLine commands:

Create tables:

0: jdbc:ignite:thin://> CREATE TABLE City (id LONG PRIMARY KEY, name VARCHAR) WITH "template=replicated";
No rows affected (0.301 seconds)

0: jdbc:ignite:thin://> CREATE TABLE Person (id LONG, name VARCHAR, city_id LONG, PRIMARY KEY (id, city_id))WITH "backups=1, affinityKey=city_id";
No rows affected (0.078 seconds)

0: jdbc:ignite:thin://> !tables
|           | PUBLIC       | CITY         | TABLE       |             |
|           | PUBLIC       | PERSON       | TABLE       |             |

Define indexes:

0: jdbc:ignite:thin://> CREATE INDEX idx_city_name ON City (name);
No rows affected (0.039 seconds)

0: jdbc:ignite:thin://> CREATE INDEX idx_person_name ON Person (name);
No rows affected (0.013 seconds)

0: jdbc:ignite:thin://> !indexes
|           | PUBLIC       | CITY         | true        |                 |
|           | PUBLIC       | PERSON       | true        |                 |

You can also watch a screencast to learn more about how to use SQLLine.