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.
|Protocol||Default Port||Flag to Specify an Alternate 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
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.
- 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.
- Enable Impala JDBC support on client systems.
- 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):
The connection string has the following format:
portvalue is typically 21050 for Impala.
To connect to an instance of Impala that requires Kerberos authentication, use a connection string of the form
jdbc:hive2://host:port/;principal=principal_name. The principal must be the same user principal you used when starting Impala. For example, you might use:
To connect to an instance of Impala that requires LDAP authentication, use a connection string of the form
jdbc:hive2://host:port/db_name;user=ldap_userid;password=ldap_password. For example, you might use:
jdbc:hive2://myhost.example.com:21050/test_db;user=fred;password=xyz123To connect to an instance of Impala over HTTP, specify the HTTP port, 28000 by default, and
transportMode=httpin the connection string. For example: