You can connect to Impala daemons through the impala-shell or through a JDBC or ODBC client. You can use the impala-shell to query data from a Linux environment. In a non-Linux environment, you can query data using JDBC and ODBC applications.
The Impala-shell is a command line tool that you can use for setting up databases and tables, inserting data, and issuing queries using SQL statements and some shell commands. The impala-shell can reside on any client machine.
You can connect to the same node and issue all SQL statements through that particular node to avoid issuing the REFRESH statement frequently. For load balancing, you can connect to different nodes for each impala-shell session. When you connect to different Impala nodes, you may need to issue the REFRESH and INVALIDATE METADATA statements to update table data and metadata.
When you run commands from within the impala-shell, use a semi-colon to terminate commands. Each command can span multiple lines. Refer to Impala-Shell Commands and Command Line Options for a list of commands and options that you can issue from within the impala-shell.
Connecting to impalad from impala-shell
You can connect to any node running the Impala daemon process from the impala-shell using the CONNECT command. Once connected, you can send queries to the Impala node from the command line.
To connect to impalad, complete the following steps:
- Issue the following command to start the impala-shell without a connection:
Issue the CONNECT command to connect to an instance of Impala, replacing impalad-host with the hostname of the node that you want to connect to.
JDBC and ODBC Clients
You can connect to any Impala daemon in the cluster from a third-party client or Java application. The client or application issues a query to an Impala daemon through an ODBC or JDBC connection. The ODBC and JDBC driver submits the query to Impala in the form of a SQL statement.
Install a JDBC or ODBC driver on the client machine and then configure the driver to enable communication between the client and Impala. For driver download, installation, and connection information, refer to the following documentation:
- JDBC Connections
- ODBC Client Connections on Linux
- ODBC Client Connections on Windows
- ODBC Client Connections on Mac OS X