drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Khurram Faraaz (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DRILL-3015) Can't connect to Squirrel using JDBC
Date Wed, 13 May 2015 21:32:02 GMT

    [ https://issues.apache.org/jira/browse/DRILL-3015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14542768#comment-14542768

Khurram Faraaz commented on DRILL-3015:

You can connect using JDBC and query for data like this. In the URL string use your IP address
or you can also say, localhost, and use your credentials username.password, and specify your
schema. Ensure that the Drillbit in started/running before you try to query for data using
JDBC. And that you have all the jars included in your CLASSPATH variable.

import org.apache.log4j.Logger;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
import java.sql.*;

public class DataFromDrill {
    public static void main(String s[]) {

        try {
                final String URL_STRING = "jdbc:drill:schema=dfs.tmp;drillbit=";
                Connection conn = DriverManager.getConnection(URL_STRING,"test","test");
                Statement stmt = conn.createStatement();

                String query = "select * from `region.parquet`";
                ResultSet rs = null;
                rs = stmt.executeQuery(query);
                    while (rs.next()) {
                        // do what you want to here
                if (rs != null)
        } catch ( Exception e ) {

> Can't connect to Squirrel using JDBC
> ------------------------------------
>                 Key: DRILL-3015
>                 URL: https://issues.apache.org/jira/browse/DRILL-3015
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Client - JDBC
>    Affects Versions: 0.9.0
>            Reporter: Murtaza
>            Assignee: Daniel Barclay (Drill)
>            Priority: Blocker
> Please suggest me what jdbc url to use with Squirrel. I have installed Apache Drill 0.9
on standalone macbook. I had given all types of jdbc url like below
> jdbc:drill:zk=;schema=dfs
> jdbc:drill:zk=;schema=dfs
> jdbc:drill:zk=KWTLT01407.local:5181/drill/drillbits1;schema=dfs
> jdbc:drill:zk=KWTLT01407.local:2181/drill/drillbits1;schema=dfs
> All is giving me error in Squirrel stating "Cannot open SQL connection".
> Please suggest me how to use JDBC to connect to Apache Drill installed on standalone

This message was sent by Atlassian JIRA

View raw message