|
| 1 | +<!-- |
| 2 | + - Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | + - contributor license agreements. See the NOTICE file distributed with |
| 4 | + - this work for additional information regarding copyright ownership. |
| 5 | + - The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | + - (the "License"); you may not use this file except in compliance with |
| 7 | + - the License. You may obtain a copy of the License at |
| 8 | + - |
| 9 | + - http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + - |
| 11 | + - Unless required by applicable law or agreed to in writing, software |
| 12 | + - distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + - See the License for the specific language governing permissions and |
| 15 | + - limitations under the License. |
| 16 | + --> |
| 17 | + |
| 18 | +<div align=center> |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | +</div> |
| 23 | + |
| 24 | +# Access Kyuubi with Kyuubi JDBC Drivers |
| 25 | + |
| 26 | +## Install Kyuubi JDBC |
| 27 | + |
| 28 | +For programing, the easiest way to get `kyuubi-hive-jdbc-shaded` is from [the maven central](https://mvnrepository.com/artifact/org.apache.kyuubi/kyuubi-hive-jdbc-shaded). For example, |
| 29 | + |
| 30 | +- **maven** |
| 31 | +```xml |
| 32 | +<dependency> |
| 33 | + <groupId>org.apache.kyuubi</groupId> |
| 34 | + <artifactId>kyuubi-hive-jdbc-shaded</artifactId> |
| 35 | + <version>1.5.0-incubating</version> |
| 36 | +</dependency> |
| 37 | +``` |
| 38 | + |
| 39 | +- **sbt** |
| 40 | +```scala |
| 41 | +libraryDependencies += "org.apache.kyuubi" % "kyuubi-hive-jdbc-shaded" % "1.5.0-incubating" |
| 42 | +``` |
| 43 | + |
| 44 | +- **gradle** |
| 45 | +```gradle |
| 46 | +implementation group: 'org.apache.kyuubi', name: 'kyuubi-hive-jdbc-shaded', version: '1.5.0-incubating' |
| 47 | +``` |
| 48 | + |
| 49 | +For BI tools, please refer to [Quick Start](../quick_start/index.html) to check the guide for the BI tool used. |
| 50 | +If you find there is no specific document for the BI tool that you are using, don't worry, the configuration part for all BI tools are basically the same. |
| 51 | +Also, we will appreciate if you can help us to improve the document. |
| 52 | + |
| 53 | +## JDBC URL |
| 54 | + |
| 55 | +JDBC URLs have the following format: |
| 56 | + |
| 57 | +``` |
| 58 | +jdbc:hive2://<host>:<port>/<dbName>;<sessionVars>?<kyuubiConfs>#<[spark|hive]Vars> |
| 59 | +``` |
| 60 | + |
| 61 | +JDBC Parameter | Description |
| 62 | +---------------| ----------- |
| 63 | +host | The cluster node hosting Kyuubi Server. |
| 64 | +port | The port number to which is Kyuubi Server listening. |
| 65 | +dbName | Optional database name to set the current database to run the query against, use `default` if absent. |
| 66 | +sessionVars | Optional `Semicolon(;)` separated `key=value` parameters for the JDBC/ODBC driver. Such as `user`, `password` and `hive.server2.proxy.user`. |
| 67 | +kyuubiConfs | Optional `Semicolon(;)` separated `key=value` parameters for Kyuubi server to create the corresponding engine, dismissed if engine exists. |
| 68 | +[spark|hive]Vars | Optional `Semicolon(;)` separated `key=value` parameters for Spark/Hive variables used for variable substitution. |
| 69 | + |
| 70 | +## Example |
| 71 | + |
| 72 | +``` |
| 73 | +jdbc:hive2://localhost:10009/default;hive.server2.proxy.user=proxy_user?kyuubi.engine.share.level=CONNECTION;spark.ui.enabled=false#var_x=y |
| 74 | +``` |
| 75 | + |
| 76 | +## Alert |
| 77 | + |
| 78 | +If you already have `hadoop-common` dependency in your classpath, you should exclude `hadoop-client-api` from `kyuubi-hive-jdbc-shaded` to avoid class confliction. For example: |
| 79 | + |
| 80 | +- **maven** |
| 81 | +```xml |
| 82 | +<dependency> |
| 83 | + <groupId>org.apache.kyuubi</groupId> |
| 84 | + <artifactId>kyuubi-hive-jdbc-shaded</artifactId> |
| 85 | + <version>1.5.0-incubating</version> |
| 86 | + <exclusion> |
| 87 | + <groupId>org.apache.hadoop</groupId> |
| 88 | + <artifactId>hadoop-client-api</artifactId> |
| 89 | + </exclusion> |
| 90 | +</dependency> |
| 91 | +``` |
| 92 | + |
| 93 | +- **sbt** |
| 94 | +```scala |
| 95 | +libraryDependencies += "org.apache.kyuubi" % "kyuubi-hive-jdbc-shaded" % "1.5.0-incubating" exclude("org.apache.hadoop", "hadoop-client-api") |
| 96 | +``` |
| 97 | + |
| 98 | +- **gradle** |
| 99 | +```gradle |
| 100 | +implementation (group: 'org.apache.kyuubi', name: 'kyuubi-hive-jdbc-shaded', version: '1.5.0-incubating') { exclude group: 'org.apache.hadoop', module: 'hadoop-client-api' } |
| 101 | +``` |
0 commit comments