Kyuubi Hive JDBC Driver#

New in version 1.4.0: Since 1.4.0, kyuubi community maintains a forked hive jdbc driver module and provides both shaded and non-shaded packages.

This packages aims to support some missing functionalities of the original hive jdbc. For kyuubi engines that support multiple catalogs, it provides meta APIs for better support. The behaviors of the original hive jdbc have remained.

To access a Hive data warehouse or new lakehouse formats, such as Apache Iceberg/Hudi, delta lake using the kyuubi jdbc driver for Apache kyuubi, you need to configure the following:

Referencing the JDBC Driver Libraries#

Before you use the jdbc driver for Apache Kyuubi, the JDBC application or Java code that you are using to connect to your data must be able to access the driver JAR files.

Using the Driver in Java Code#

In the code, specify the artifact kyuubi-hive-jdbc-shaded from Maven Central according to the build tool you use.

Maven#

<dependency>
    <groupId>org.apache.kyuubi</groupId>
    <artifactId>kyuubi-hive-jdbc-shaded</artifactId>
    <version>1.5.2-incubating</version>
</dependency>

Sbt#

libraryDependencies += "org.apache.kyuubi" % "kyuubi-hive-jdbc-shaded" % "1.5.2-incubating"

Gradle#

implementation group: 'org.apache.kyuubi', name: 'kyuubi-hive-jdbc-shaded', version: '1.5.2-incubating'

Using the Driver in a JDBC Application#

For JDBC Applications, such as BI tools, SQL IDEs, please check the specific guide for detailed information.

Note

Is your favorite tool missing? Report an feature request or help us document it.

Registering the Driver Class#

Before connecting to your data, you must register the JDBC Driver class for your application.

  • org.apache.kyuubi.jdbc.KyuubiHiveDriver

  • org.apache.kyuubi.jdbc.KyuubiDriver (Deprecated)

The following sample code shows how to use the java.sql.DriverManager class to establish a connection for JDBC:

private static Connection connectViaDM() throws Exception
{
   Connection connection = null;
   connection = DriverManager.getConnection(CONNECTION_URL);
   return connection;
}

Building the Connection URL#

Basic Connection URL format#

Use the connection URL to supply connection information to the kyuubi server or cluster that you are accessing. The following is the format of the connection URL for the Kyuubi Hive JDBC Driver

jdbc:subprotocol://host:port/schema;<clientProperties;><[#|?]sessionProperties>
  • subprotocol: kyuubi or hive2

  • host: DNS or IP address of the kyuubi server

  • port: The number of the TCP port that the server uses to listen for client requests

  • dbName: Optional database name to set the current database to run the query against, use default if absent.

  • clientProperties: Optional semicolon(;) separated key=value parameters identified and affect the client behavior locally. e.g., user=foo;password=bar.

  • sessionProperties: Optional semicolon(;) separated key=value parameters used to configure the session, operation or background engines. For instance, kyuubi.engine.share.level=CONNECTION determines the background engine instance is used only by the current connection. spark.ui.enabled=false disables the Spark UI of the engine.

Important

  • The sessionProperties MUST come after a leading number sign(#) or question mark (?).

  • Properties are case-sensitive

  • Do not duplicate properties in the connection URL

Connection URL over Http#

New in version 1.6.0.

jdbc:subprotocol://host:port/schema;transportMode=http;httpPath=<http_endpoint>
  • http_endpoint is the corresponding HTTP endpoint configured by kyuubi.frontend.thrift.http.path at the server side.

Connection URL over Service Discovery#

jdbc:subprotocol://<zookeeper quorum>/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=kyuubi
  • zookeeper quorum is the corresponding zookeeper cluster configured by kyuubi.ha.zookeeper.quorum at the server side.

  • zooKeeperNamespace is the corresponding namespace configured by kyuubi.ha.zookeeper.namespace at the server side.

Authentication#

DataTypes#