To use the JDBC Driver to access Drill through Squirrel, ensure that you meet the prerequisites and follow the steps in this section.
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, create the entry in /etc/hosts.
127.0.1.1 maprdemo
The Drill JDBC Driver JAR
file must exist in a directory on your Windows
machine in order to configure the driver in the SQuirreL client.
You can copy the Drill JDBC JAR
file from the following Drill installation
directory on the node with Drill installed, to a directory on your Windows
machine:
<drill_installation_directory>/jars/jdbc-driver/drill-jdbc-all-0.7.0-SNAPSHOT.jar
Or, you can download the apache- drill-0.7.0.tar.gz file to a location on your Windows machine, and extract the contents of the file. You may need to use a decompression utility, such as 7-zip to extract the archive. Once extracted, you can locate the driver in the following directory:
<windows_directory>\apache-drill-<version>\jars\jdbc-driver\drill-jdbc-all-0.7.0-SNAPSHOT.jar
To install and start SQuirreL, complete the following steps:
JAR
file. The SQuirreL installation wizard walks you through the installation process.squirrel-sql.bat
to start SQuirreL.To add the Drill JDBC Driver to SQuirreL, define the driver and create a database alias. The alias is a specific instance of the driver configuration. SQuirreL uses the driver definition and alias to connect to Drill so you can access data sources that you have registered with Drill.
To define the Drill JDBC Driver, complete the following steps:
In the SQuirreL toolbar, select Drivers > New Driver. The Add Driver dialog box appears.
Enter the following information:
Option | Description |
Name | Name for the Drill JDBC Driver |
Example URL | jdbc:drill:zk=<zookeeper_quorum>[;schema=<schema_to_use_as_default>] Example: jdbc:drill:zk=maprdemo:5181 Note: The default ZooKeeper port is 2181. In a MapR cluster, the ZooKeeper port is 5181. |
Website URL | jdbc:drill:zk=<zookeeper_quorum>[;schema=<schema_to_use_as_default>] Example: Note: The default ZooKeeper port is 2181. In a MapR cluster, the ZooKeeper port is 5181. |
Extra Class Path | Click Add and navigate to the JDBC JAR file location in the Windows directory:<windows_directory>/jars/jdbc-driver/drill-jdbc-all-0.6.0-incubating.jar Select the JAR file, click Open, and then click List Drivers. |
Class Name | Select org.apache.drill.jdbc.Driver from the drop-down menu. |
Click OK. The SQuirreL client displays a message stating that the driver registration is successful, and you can see the driver in the Drivers panel.
To create an alias, complete the following steps:
In the SQuirreL toolbar, select Aliases >New Alias. The Add Alias dialog box appears.
Enter the following information:
Option | Description |
Alias Name | A unique name for the Drill JDBC Driver alias. |
Driver | Select the Drill JDBC Driver. |
URL | Enter the connection URL with the name of the Drill directory stored in ZooKeeper and the cluster ID:
jdbc:drill:zk=<zookeeper_quorum>/<drill_directory_in_zookeeper>/<cluster_ID>;schema=<schema_to_use_as_default>
The following examples show URLs for Drill installed on a single node:jdbc:drill:zk=10.10.100.56:5181/drill/demo_mapr_com-drillbits;schema=hive jdbc:drill:zk=10.10.100.24:2181/drill/drillbits1;schema=hive The following example shows a URL for Drill installed in distributed mode with a connection to a ZooKeeper quorum: jdbc:drill:zk=10.10.100.30:5181,10.10.100.31:5181,10.10.100.32:5181/drill/drillbits1;schema=hive
|
User Name | admin |
Password | admin |
Click Ok. The Connect to: dialog box appears.
Click Connect. SQuirreL displays a message stating that the connection is successful.
Click OK. SQuirreL displays a series of tabs.
Once you have SQuirreL successfully connected to your cluster through the Drill JDBC Driver, you can issue queries from the SQuirreL client. You can run a test query on some sample data included in the Drill installation to try out SQuirreL with Drill.
To query sample data with Squirrel, complete the following steps:
Enter the following query in the query box:
SELECT * FROM cp.`employee.json`;
Example:
Press Ctrl+Enter to run the query. The following query results display:
You have successfully run a Drill query from the SQuirreL client.