EXAplus CLI

This section explains how to connect EXAplus to Exasol and run an SQL statement.

EXAplus is a simple command line interface client for running SQL statements in Exasol. EXAplus is a Java console application and is available in versions for Windows and Linux.

Windows

Environments

EXAplus has been successfully tested on the following systems:

  • Windows 10 (x86/x64)
  • Windows 7, Service Pack 1 (x86/x64)
  • Windows Server 2012 R2 (x86/x64)
  • Windows Server 2012 (x86/x64)
  • Windows Server 2008 R2, Service Pack 1 (x86/x64)
  • Windows Server 2008, Service Pack 2 (x86/x64)

Prerequisites

  • You must have Administrator rights on your Windows system.
  • Microsoft .NET Framework 4.0 Client Profile must be installed.
  • EXAplus requires a Java runtime environment for execution. To be able to use all features of EXAplus we recommend to use at least Java 7 and applied updates. We recommend that you select support for additional languages during the Java installation.
  • For correct formatting of special Unicode characters (such as Japanese characters), a font that is capable of displaying those characters must be installed on your Windows system.
  • Download and install the EXAplus client from the Exasol Downloads Portal.

Procedure

  1. Open a command line shell in Windows and run the exaplusx64.exe executable from the EXAplus installation directory.

    The default location for the installation directory is C:\Program Files\Exasol\EXASolution-7.1\EXAplus.

    EXAplus CLI 7.1.x can be used to connect to Exasol 8 databases. There is currently no specific version of EXAplus CLI for Exasol 8.

    You can provide additional command line parameters to select different options when starting the EXAplus client. For a complete list of available options, see EXAplus Command Line Parameters (Console mode only).

  2. Enter the username and password for the Exasol database.
  3. Enter the connection string to connect to the Exasol database.

    If the connection uses a TLS certificate and a valid certification path is not found, you may need to include the certificate fingerprint in the connection string.

    You can also run the JAR executable file directly from the command line shell using the command java -jar exaplus.jar. In this case the connection string and any command line parameters should be added after the JAR file path:

    java -jar exaplus.jar -c <hostname><fingerprint>:8563 -u <user> -P <password>
  4. After successfully connecting to the database, an interactive session is started where you can send SQL commands (refer to SQL Reference) or EXAplus commands (refer to EXAplus Commands) to the database. Result tables will be displayed as text.

    When using some options, such as -f, an interactive session will not be started.

    For example:

    EXAplus in cmd

Linux and Mac OS

Environments

EXAplus has been successfully tested on the following systems using the specified Java version with the latest available updates:

  • Red Hat / CentOS 7, OpenJDK JVM 1.8.0 (x64)
  • Red Hat / CentOS 6, OpenJDK JVM 1.8.0 (x86/x64)
  • Debian 8, OpenJDK JVM 1.7.0 (x86/x64)
  • Ubuntu 16.04 LTS, OpenJDK JVM 1.8.0 (x86/64)
  • Ubuntu 14.04 LTS, OpenJDK JVM 1.7.0 (x86/64)
  • SUSE Linux Enterprise Server 12, IBM's JVM 1.7.0 (x64)
  • SUSE Linux Enterprise Desktop 12, OpenJDK JVM 1.7.0 (x64)
  • SUSE Linux Enterprise Server 11 Service Pack 3, IBM's JVM 1.7.0 (x86/x64)
  • openSUSE Leap 42.2, OpenJDK JVM 1.8.0 (x64)
  • macOS Sierra, JVM 1.8.0 (64Bit)
  • OS X 10.11, JVM 1.8.0 (64Bit)
  • FreeBSD 11.0, OpenJDK 1.8.0 (64Bit)
  • FreeBSD 10.3, OpenJDK 1.8.0 (64Bit)

Prerequisite

  • Exasol should be installed and running on your system.
  • Java 7 or higher must be installed and the “java” executable must be included in the path.
  • For correct formatting of special Unicode characters (such as Japanese characters), a font that is capable of displaying those characters must be installed on your system.
  • To input Japanese characters using SCIM, we recommend installing SCIM version 1.4.7 or higher. Scim-Anthy for Japanese character support should be version 1.2.4 or higher.

Procedure

  1. Copy the URL of the EXAplus Linux (x86_64) installer from Exasol Downloads Portal.

    EXAplus CLI 7.1.x can be used to connect to Exasol 8 databases. There is currently no specific version of EXAplus CLI for Exasol 8.

  2. Run the following command using the path to the installer file.
  3. curl <installer download path> -o <filename>

    For example:

    curl https://x-up.s3.amazonaws.com/7.x/7.1.7/EXAplus-7.1.7.tar.gz -o EXAplus-7.1.7.tar.gz
  4. Use tar -xzf <filename> to extract the installer file. For example:
    tar -xzf EXAplus-7.1.7.tar.gz
  5. Go to the directory where you have extracted the EXAplus files. You can use the -help command to see the list of available options. Refer to EXAplus Command Line Parameters (Console mode only) for a complete list of available options.
  6. Enter the connection details to connect to Exasol database. For example:
    ./exaplus -c 10.15.118.11:8563 -u sys -p exasol

    In the above command, -c is connection string, -u is the user, and -p is the password of the user.

    If the connection uses a TLS certificate and a valid certification path is not found, you may need to include the certificate fingerprint in the connection string.

  7. After successfully connecting to the database, an interactive session is started where the user can send SQL commands (refer to SQL Reference) or EXAplus commands (refer to EXAplus Commands) to the database. Result tables will be displayed as text.

    For example:

    Connect EXAplus Commandline to Exasol

    When using some options, such as -f, an interactive session will not be started.

Notes

  • You can exit EXAplus using the commands EXIT and QUIT.
  • All commands except EXIT and QUIT have to be finished by a semicolon (;), with the exception of function and script definitions, which must be finished by a forward slash (/) on a new line.
  • The command history can be viewed by using the up/down arrow keys.
  • Multi-line commands can be aborted by the shortcut <CTRL>-T.
  • Clicking <TAB> will make EXAplus try to autocomplete the input.
  • All command line parameters are case sensitive.

EXAplus Command Line Parameters (Console mode only)

Parameters Annotation
Help Options
-help Displays an overview of the command line parameters.
-version Displays version information.
Connection Options
-c <connection string> Connection data which consists of the cluster nodes and the port (for example, 192.168.6.11..14:8563).
-u <user> User name for logging in to Exasol.
-p <passwd> Password for logging in to Exasol.
-s <schema> EXAplus will attempt to open the specified schema after logging in to Exasol.
-L Only one login attempt is performed. If the user name and password are specified in the command line, no connection is made in the event of an incorrect password. This parameter is very useful for utilization in scripts.
-profile <profile name>

Name of a connection profile defined in <configDir>/profiles.xml. For more information, see Profile Handling Options.

<configDir> here refers to the Exasol configuration directory on your local system. On a Windows system this is typically C:\Users\[username]\exasol and on a Linux system it is ~/.exasol

-k Use Kerberos based single sign-on.
Profile Handling Options
-wp <profile name>

Write connection options to a specified connection profile and exit. The saved profile can then be used to connect to Exasol.

For example:

user@localhost:~/EXAplus-7.1.7$ ./exaplus -c localhost:8563 -u sys -p exasol -wp my_profile
EXAplus 7.1.7 (c) EXASOL AG

Profile my_profile is saved.

user@localhost:~/EXAplus-7.1.7$ ./exaplus -profile my_profile
EXAplus 7.1.7 (c) EXASOL AG

Friday, May 6, 2022 at 9:55:56 AM Central European Summer Time
Connected to database DB1 as user sys.
EXASolution 7.1.7 (c) EXASOL AG

SQL_EXA>
-lp Print a list of existing profiles and exit.
-dp <profile name> Delete a specified profile and exit.
File Options

SQL files can be integrated via the parameters -f or -B, or via the EXAplus commands start, @, and @@. Refer to EXAplus Commands for more information.

EXAplus will first search for the specified files relatively to the working directory and in the folders which are defined in the environment variable SQLPATH. If the files are not found, EXAplus also tries to add an implicit .sql and .SQL ending.

The variable SQLPATH contains similar to the variable PATH a list of folder, separated by a colon (:) under Linux and by a semicolon (;) under Windows.

-init <file>

File which is initially executed after the start.

Default: exaplus.sql

-f <file> EXAplus executes all the statements in the file and then terminates. If auto-commit is enabled, EXAplus executes a COMMITafter each statement in the file and then terminates at the end of the file.
-B <file> Similar to -f, but EXAplus executes all commands at once in batch mode. If auto-commit is enabled, EXAplus executes a COMMIT only at the end of the file and then terminates.
-encoding <encoding>

Sets the character set for reading of SQL-scripts started with -f or -B. For supported encodings, refer to the Supported Encodings for ETL Processes section.

Default: UTF-8

By using the command SET ENCODING you can also change the character set during a session. The change will not affect already opened files.

-- <args>

SQL files can use arguments given over via the parameter -- by evaluating the variables &1, &2, and so on.

For example, the file test.sql including the content

--test.sql
SELECT * FROM &1;

can be called in the following way: 

exaplus -f test.sql -- dual
Reconnect Options
-recoverConnection <ON|OFF>

Attempts to recover a lost connection.

Default: OFF

-retry <num>

Determines the number of attempts to recover a connection. If either -1 or UNLIMITED is specified, repeated attempts will be made to recover the connection indefinitely.

Default: UNLIMITED

-retryDelay <num>

Minimum interval between two recovery attempts in seconds.

Default: 5

-closeOnConnectionLost

Exits EXAplus after the loss of a connection that cannot be recovered.

Default: ON

Other Options
-autocommit <ON|OFF|EXIT> Sets the auto-commit mode. ON enables auto-commit, OFF disables it. EXIT effects an auto-commit when the program is exited or disconnected.
Default: ON
-lang <EN|DE|JA> Defines the language of EXAplus messages.
Default: Depends on the system preferences
-characterwidth <HALF|FULL>

Defines the width of Unicode characters when displaying a query result.
Default:

  • lang = EN or DE - HALF
  • lang = JA - FULL
-q Quiet mode which suppresses additional output from EXAplus.
-x Stops EXAplus in the event of errors.
-F <num>

Determines the fetchsize in kB which specifies the amount of resultset data is sent during one single communication step with the database.

Default: 2000

-Q <num>

Query Timeout in seconds. A query will be aborted if the timeout is exceeded.

Default: -1 (unlimited)

-autoCompletion <ON|OFF>

If this function is enabled, the user can obtain proposals by pressing TAB. When using scripts, this prediction aid will be automatically deactivated.

Default: ON

-pipe

With this parameter you can use pipes on Linux/Unix systems. For example:


echo "SELECT * FROM dual;" | exaplus -pipe -c ... -u ... -p ...
echo file.csv | perl exaplus -c host -u login -p pass -s schema -sql "import into tst_pipe_import FROM LOCAL CSV FILE 'System.in';" -pipe

Default: OFF

-sql <SQL statement> With this parameter you can execute single SQL statements. EXAplus quits afterwards. Example: -sql "SELECT \"DUMMY\" FROM dual;"
-jdbcparam <JDBC parameter> Set additional JDBC parameters.

 

Next Steps

After connecting EXAplus CLI to Exasol, you can start loading data into the Exasol database. For more information, see Load Data.