Update Using JDBC topic
Project: http://git-wip-us.apache.org/repos/asf/drill/repo Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/cfd4573a Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/cfd4573a Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/cfd4573a Branch: refs/heads/gh-pages Commit: cfd4573a2f0dfe36f7355213f5f3e6b6e2dc97a6 Parents: 05f79eb Author: Bob Rumsby <[email protected]> Authored: Thu Jun 11 17:49:19 2015 -0700 Committer: Kristine Hahn <[email protected]> Committed: Fri Jun 19 14:43:21 2015 -0700 ---------------------------------------------------------------------- _data/docs.json | 75 ++++++++++++++--- .../015-using-jdbc-driver.md | 89 +++++++++++--------- 2 files changed, 114 insertions(+), 50 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/drill/blob/cfd4573a/_data/docs.json ---------------------------------------------------------------------- diff --git a/_data/docs.json b/_data/docs.json index 204c4fa..6989a98 100644 --- a/_data/docs.json +++ b/_data/docs.json @@ -4185,8 +4185,8 @@ } ], "children": [], - "next_title": "Using JDBC with SQuirreL on Windows", - "next_url": "/docs/using-jdbc-with-squirrel-on-windows/", + "next_title": "Using the JDBC Driver", + "next_url": "/docs/using-the-jdbc-driver/", "parent": "ODBC/JDBC Interfaces", "previous_title": "ODBC/JDBC Interfaces", "previous_url": "/docs/odbc-jdbc-interfaces/", @@ -4920,8 +4920,8 @@ } ], "children": [], - "next_title": "Using JDBC with SQuirreL on Windows", - "next_url": "/docs/using-jdbc-with-squirrel-on-windows/", + "next_title": "Using the JDBC Driver", + "next_url": "/docs/using-the-jdbc-driver/", "parent": "ODBC/JDBC Interfaces", "previous_title": "ODBC/JDBC Interfaces", "previous_url": "/docs/odbc-jdbc-interfaces/", @@ -4937,11 +4937,28 @@ } ], "children": [], - "next_title": "Installing the ODBC Driver", - "next_url": "/docs/installing-the-odbc-driver/", + "next_title": "Using JDBC with SQuirreL on Windows", + "next_url": "/docs/using-jdbc-with-squirrel-on-windows/", "parent": "ODBC/JDBC Interfaces", "previous_title": "Interfaces Introduction", "previous_url": "/docs/interfaces-introduction/", + "relative_path": "_docs/odbc-jdbc-interfaces/015-using-jdbc-driver.md", + "title": "Using the JDBC Driver", + "url": "/docs/using-the-jdbc-driver/" + }, + { + "breadcrumbs": [ + { + "title": "ODBC/JDBC Interfaces", + "url": "/docs/odbc-jdbc-interfaces/" + } + ], + "children": [], + "next_title": "Installing the ODBC Driver", + "next_url": "/docs/installing-the-odbc-driver/", + "parent": "ODBC/JDBC Interfaces", + "previous_title": "Using the JDBC Driver", + "previous_url": "/docs/using-the-jdbc-driver/", "relative_path": "_docs/odbc-jdbc-interfaces/020-using-jdbc-with-squirrel-on-windows.md", "title": "Using JDBC with SQuirreL on Windows", "url": "/docs/using-jdbc-with-squirrel-on-windows/" @@ -10633,8 +10650,8 @@ "next_title": "Installing the ODBC Driver", "next_url": "/docs/installing-the-odbc-driver/", "parent": "ODBC/JDBC Interfaces", - "previous_title": "Interfaces Introduction", - "previous_url": "/docs/interfaces-introduction/", + "previous_title": "Using the JDBC Driver", + "previous_url": "/docs/using-the-jdbc-driver/", "relative_path": "_docs/odbc-jdbc-interfaces/020-using-jdbc-with-squirrel-on-windows.md", "title": "Using JDBC with SQuirreL on Windows", "url": "/docs/using-jdbc-with-squirrel-on-windows/" @@ -10702,6 +10719,23 @@ "title": "Using Tibco Spotfire with Drill", "url": "/docs/using-tibco-spotfire-with-drill/" }, + "Using the JDBC Driver": { + "breadcrumbs": [ + { + "title": "ODBC/JDBC Interfaces", + "url": "/docs/odbc-jdbc-interfaces/" + } + ], + "children": [], + "next_title": "Using JDBC with SQuirreL on Windows", + "next_url": "/docs/using-jdbc-with-squirrel-on-windows/", + "parent": "ODBC/JDBC Interfaces", + "previous_title": "Interfaces Introduction", + "previous_url": "/docs/interfaces-introduction/", + "relative_path": "_docs/odbc-jdbc-interfaces/015-using-jdbc-driver.md", + "title": "Using the JDBC Driver", + "url": "/docs/using-the-jdbc-driver/" + }, "Value Vectors": { "breadcrumbs": [ { @@ -11998,8 +12032,8 @@ } ], "children": [], - "next_title": "Using JDBC with SQuirreL on Windows", - "next_url": "/docs/using-jdbc-with-squirrel-on-windows/", + "next_title": "Using the JDBC Driver", + "next_url": "/docs/using-the-jdbc-driver/", "parent": "ODBC/JDBC Interfaces", "previous_title": "ODBC/JDBC Interfaces", "previous_url": "/docs/odbc-jdbc-interfaces/", @@ -12015,11 +12049,28 @@ } ], "children": [], - "next_title": "Installing the ODBC Driver", - "next_url": "/docs/installing-the-odbc-driver/", + "next_title": "Using JDBC with SQuirreL on Windows", + "next_url": "/docs/using-jdbc-with-squirrel-on-windows/", "parent": "ODBC/JDBC Interfaces", "previous_title": "Interfaces Introduction", "previous_url": "/docs/interfaces-introduction/", + "relative_path": "_docs/odbc-jdbc-interfaces/015-using-jdbc-driver.md", + "title": "Using the JDBC Driver", + "url": "/docs/using-the-jdbc-driver/" + }, + { + "breadcrumbs": [ + { + "title": "ODBC/JDBC Interfaces", + "url": "/docs/odbc-jdbc-interfaces/" + } + ], + "children": [], + "next_title": "Installing the ODBC Driver", + "next_url": "/docs/installing-the-odbc-driver/", + "parent": "ODBC/JDBC Interfaces", + "previous_title": "Using the JDBC Driver", + "previous_url": "/docs/using-the-jdbc-driver/", "relative_path": "_docs/odbc-jdbc-interfaces/020-using-jdbc-with-squirrel-on-windows.md", "title": "Using JDBC with SQuirreL on Windows", "url": "/docs/using-jdbc-with-squirrel-on-windows/" http://git-wip-us.apache.org/repos/asf/drill/blob/cfd4573a/_docs/odbc-jdbc-interfaces/015-using-jdbc-driver.md ---------------------------------------------------------------------- diff --git a/_docs/odbc-jdbc-interfaces/015-using-jdbc-driver.md b/_docs/odbc-jdbc-interfaces/015-using-jdbc-driver.md index b2339fe..9f471eb 100755 --- a/_docs/odbc-jdbc-interfaces/015-using-jdbc-driver.md +++ b/_docs/odbc-jdbc-interfaces/015-using-jdbc-driver.md @@ -9,14 +9,12 @@ This section explains how to install and use the JDBC driver for Apache Drill. F * JRE 7 or JDK 7 * Drill installed either in embedded mode or in distributed mode on one or more nodes in a cluster. Refer to the [Install Drill]({{ site.baseurl }}/docs/install-drill/) documentation for more information. - * The client must be able to resolve the actual hostname of the Drill node(s) with the IP(s). Verify that a DNS entry was created on the client machine for the Drill node(s). - -If a DNS entry does not exist, create the entry for the Drill node(s). + * The client must be able to resolve the actual hostname of the Drill node(s) with the IP(s). Verify that a DNS entry was created on the client machine for the Drill node(s). If a DNS entry does not exist, create the entry for the Drill node(s). * For Windows, create the entry in the %WINDIR%\system32\drivers\etc\hosts file. * For Linux and Mac OSX, create the entry in /etc/hosts. <drill-machine-IP> <drill-machine-hostname> - Example: `127.0.1.1 maprdemo` + For example: `127.0.1.1 maprdemo` ---------- @@ -25,25 +23,20 @@ If a DNS entry does not exist, create the entry for the Drill node(s). The Drill JDBC Driver `JAR` file must exist in a directory on a client machine so you can configure the driver for the application or third-party tool that you intend to use. You can obtain the driver in two different ways: -1. Copy the `drill-jdbc-all` JAR file from the following Drill installation directory on a node where Drill is installed to a directory on your client -machine: +1. Copy the `drill-jdbc-all` JAR file from the following Drill installation directory on a node where Drill is installed to a directory on your client machine: - <drill_installation_directory>/jars/jdbc-driver/drill-jdbc-all-<version>.jar + <drill_installation_directory>/jars/jdbc-driver/drill-jdbc-all-<version>.jar - For example: drill1.0/jdbc-driver/drill-jdbc-all-1.0.0-mapr-r1.jar + For example, on a MapR cluster: `/opt/mapr/drill/drill-1.0.0/jars/jdbc-driver/drill-jdbc-all-1.0.0-mapr-r1.jar` 2. Download the following tar file to a location on your client machine: [apache- drill-1.0.0.tar.gz](http://apache.osuosl.org/drill/drill-1.0.0/apache-drill-1.0.0-src.tar.gz) and extract the file. You may need to use a decompression utility, such as [7-zip](http://www.7-zip.org/). The driver is extracted to the following directory: - <drill-home>\apache-drill-<version>\jars\jdbc-driver\drill-jdbc-all-<version>.jar - -Mac vs windows paths here.... - -On a MapR cluster, the JDBC driver is installed here: `/opt/mapr/drill/drill-1.0.0/jars/jdbc-driver/` + <drill-home>\apache-drill-\<version>\jars\jdbc-driver\drill-jdbc-all-<version>.jar ---------- -### JDBC Driver URLs +### Configuring a Driver Application or Client To configure a JDBC application, users have to: @@ -51,50 +44,70 @@ To configure a JDBC application, users have to: 2. Use a valid Drill JDBC URL. 3. Configure tools or application code with the name of the Drill driver class. -The driver URLs that you use to create JDBC connection strings must be formed as stated in the following sections. +Most client tools provide a UI where you can enter all of the required connection information, including the Driver location, connection URL, and driver class name. +### JDBC Driver URLs -#### Driver Class Name +The driver URLs that you use to create JDBC connection strings must be formed as follows: -The class name for the JDBC driver is `org.apache.drill.jdbc.Driver` +`jdbc:drill:zk=<zookeeper_quorum>:<port>/<drill_directory_in_zookeeper>/<cluster_ID>;schema=<schema_to_use_as_default>` -#### URL Syntax +Any Drill JDBC URL must start with: `jdbc:drill`. -The form of the driver's JDBC URLs is as follows. The URL consists of some required and some optional parameters. +**ZooKeeper Quorum** -A Drill JDBC URL must start with: `"{{jdbc:drill:}}"` +To connect to a cluster, specify the ZooKeeper quorum as a list of hostnames or IP addresses. -#### URL Examples +**ZooKeeper Port Number** -`jdbc:drill:zk=maprdemo:5181` +The default ZooKeeper port is 2181. On a MapR cluster, the ZooKeeper port is 5181. -where `zk=maprdemo:5181` defines the ZooKeeper quorum. +**Drill Directory in ZooKeeper** -`jdbc:drill:zk=10.10.100.56:5181/drill/drillbits1;schema=hive` +The name of the Drill directory stored in ZooKeeper is `/drill`. -where the ZooKeeper node IP address is provided as well as the Drill directory in ZK and the cluster ID? +**Cluster ID** -`jdbc:drill:zk=10.10.100.30:5181,10.10.100.31:5181,10.10.100.32:5181/drill/drillbits1;schema=hive` +The Drill default cluster ID is <code>drillbits1</code>. -<li>Including a default schema is optional.</li> -<li>The ZooKeeper port is 2181. In a MapR cluster, the ZooKeeper port is 5181.</li> -<li>The Drill directory stored in ZooKeeper is <code>/drill</code>.</li> -<li>The Drill default cluster ID is<code> drillbits1</code>.</li> +On a MapR cluster, check the following file for the cluster ID: ---------- +`/opt/mapr/drill/drill-1.0.0/conf/drill-override.conf` -### JDBC Driver Configuration Options +For example: -To control the behavior of the Drill JDBC driver, you can append the following configuration options to the JDBC URL: +`... +drill.exec: { + cluster-id: "docs41cluster-drillbits", + zk.connect: "centos23.lab:5181,centos28.lab:5181,centos29.lab:5181" +} +...` -<config options> +**Schema** +Optionally, include the default schema for the JDBC connection. For example: + +`schema=hive` ----------- +### URL Examples -### Related Documentation +**Single-Node Installation** -When you have connected to Drill through the JDBC Driver, you can issue queries from the JDBC application or client. Start by running -a test query on some sample data included in the Drill installation. +`jdbc:drill:zk=maprdemo:5181` + +`jdbc:drill:zk=centos23.lab:5181/drill/docs41cluster-drillbits` + +`jdbc:drill:zk=10.10.100.56:5181/drill/drillbits1;schema=hive` + +**Cluster Installation** + +`jdbc:drill:zk=10.10.100.30:5181,10.10.100.31:5181,10.10.100.32:5181/drill/drillbits1;schema=hive` + +--------- + +### Driver Class Name + +The class name for the JDBC driver is `org.apache.drill.jdbc.Driver` +----------- \ No newline at end of file
