Configuring JDBC for Impala

Download and configure the JDBC driver to access Impala from a Java program that you write, or a Business Intelligence or similar tool that uses JDBC to communicate with database products.

The following are the default ports that Impala server accepts JDBC connections through:
Protocol Default Port Flag to Specify an Alternate Port
HTTP 28000 ‑‑hs2_http_port
Binary TCP 21050 ‑‑hs2_port

Make sure the port for the protocol you are using is available for communication with clients, for example, that it is not blocked by firewall software.

If your JDBC client software connects to a different port, specify that alternative port number with the flag in the above table when starting the impalad.

  1. Configure the JDBC port.
    Impala server accepts JDBC connections through port 21050 by default. Make sure this port is available for communication with other hosts on your network, for example, that it is not blocked by firewall software. If your JDBC client software connects to a different port, specify that alternative port number in the Impala Daemon HiveServer2 Portfield in Cloudera Manager, in the Configuration tab.
  2. Install the JDBC driver.
    Impala has been tested using the Impala JDBC driver version 2.5.45 and 2.6.2. Cloudera recommends that you use one of these two versions with Impala.
  3. Enable Impala JDBC support on client systems.
  4. Establish JDBC connections.

    The JDBC driver class depends on which driver you select.

    Using the Cloudera JDBC Connector (recommended):

    Depending on the level of the JDBC API your application is targeting, you can use the following fully-qualified class names (FQCNs):

    • com.cloudera.impala.jdbc41.Driver
    • com.cloudera.impala.jdbc41.DataSource
    • com.cloudera.impala.jdbc4.Driver
    • com.cloudera.impala.jdbc4.DataSource
    • com.cloudera.impala.jdbc3.Driver
    • com.cloudera.impala.jdbc3.DataSource

    The connection string has the following format:

    jdbc:impala://Host:Port[/Schema];Property1=Value;Property2=Value;...

    The port value is typically 21050 for Impala.

    To connect to an instance of Impala that requires Kerberos authentication, use a connection string of the form jdbc:impala://host:port/;principal=principal_name. The principal must be the same user principal you used when starting Impala.

    To connect to an instance of Impala that requires LDAP authentication, use a connection string of the form jdbc:impala://host:port/db_name;user=ldap_userid;password=ldap_password.

    To connect to an instance of Impala over HTTP, specify the HTTP port, 28000 by default, and transportMode=http in the connection string.

    For updated information on the version of the JDBC driver you are using and for connection string examples for different supported authentications, refer to the link provided under Related Information.