Yes. I believe its a necessary parameter if non default cluster I'd is used and 
given in the connection url. You can check if it works with directory specified.

Get Outlook for Android<https://aka.ms/ghei36>

________________________________
From: Tushar Pathare <tpath...@sidra.org>
Sent: Tuesday, January 8, 2019 11:40:22 PM
To: user@drill.apache.org
Subject: Re: Drill connection using jdbc

Is it necessary because I thought it is optional including the cluster ID


Tushar Bhalchandra Pathare
Bigdata,GPFS,CSXF – Research Department
t. +974 4003 7443
m. +974 74793547
PO BOX 26999 Doha, Qatar
sidra.org <http://www.sidra.org/>


On 1/9/19, 10:39 AM, "Arjun kr" <arjun...@outlook.com> wrote:

    Are you missing drill zk directory in connection url?
    By default, it's value is drill.

    jdbc:drill:zk=<zk name>[:<port>][,<zk name2>[:<port>]...
    <directory>/<cluster ID>;[schema=<storage plugin>]


    
https://drill.apache.org/docs/using-the-<https://drill.apache.org/docs/using-the-jdbc-driver/>jdbc<https://drill.apache.org/docs/using-the-jdbc-driver/>-driver/<https://drill.apache.org/docs/using-the-jdbc-driver/>

    Thanks,

    Arjun

    Get Outlook for Android<https://aka.ms/ghei36>

    ________________________________
    From: Khurram Faraaz <kfar...@mapr.com>
    Sent: Tuesday, January 8, 2019 11:17:58 PM
    To: user@drill.apache.org
    Subject: Re: Drill connection using jdbc

    Hi Tushar,

    This example works just fine for me, you may want to use the template

    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.*;
    import java.io.*;
    import java.lang.*;
    import java.util.*;
    import java.util.Scanner;

    public class TestQuery {

    public static void main(String s[]) throws Exception {

        Connection conn = null;
        PreparedStatement prdstmnt = null;
        try {
                // Please replace test1302-145 with your hostname, name of host
    where Drillbit is up and running
                final String URL_STRING =
    "jdbc:drill:schema=dfs.tmp;drillbit=test1302-145";
                Class.forName("org.apache.drill.jdbc.Driver").newInstance();

                // Please replace username and password with your username and
    password
                conn = DriverManager.getConnection(URL_STRING,"mapr","mapr");
                prdstmnt = conn.prepareStatement("SELECT * FROM
    cp.`employee.json`");
                prdstmnt.executeQuery();
                prdstmnt.close();
        } catch (Exception e) {
           System.out.println(e.getMessage());
           e.printStackTrace();
        } finally {
            if(conn != null)
                try { conn.close(); } catch(SQLException sqlexcpn){
    sqlexcpn.printStackTrace(); }
            if(prdstmnt != null)
                try { prdstmnt.close(); } catch(SQLException sqlexcpn){
    sqlexcpn.printStackTrace(); }
            }
        }
    }

    Regards,
    Khurram

    On Tue, Jan 8, 2019 at 11:10 PM Tushar Pathare <tpath...@sidra.org> wrote:

    > Hello Team,
    >
    >                     We have installed drill 1.12.0 and trying to connect
    > using a client to the drill cluster
    >
    > Our config for connection is
    >
    >
    >
    > Drill class is : org.apache.drill.jdbc.Driver
    >
    > Driver location is
    > 
/Users/tpathare/Downloads/apache-drill-1.12.0/jars/jdbc-driver/drill-jdbc-all-1.12.0.jar
    >
    > Jdbc url is : jdbc:drill:zk=172.32.63.64:2181,172.32.63.65:2181,
    > 172.32.63.67:2181
    >
    >
    >
    > When I hit connect I see the following error.Though the cluster is up and
    > running and ZK is also good.
    >
    >
    >
    > *ERROR: An error occurred while trying to make a connection to *
    >
    > *the database:  *
    >
    >
    >
    > *JDBC URL: *
    >
    > *jdbc:drill:zk=172.32.63.64:2181
    > <http://172.32.63.64:2181>,172.32.63.65:2181
    > <http://172.32.63.65:2181>,172.32.63.67:2181/sidra-drillbit
    > <http://172.32.63.67:2181/sidra-drillbit> *
    >
    >
    >
    > *Failure in connecting to Drill: *
    >
    > *oadd.org.apache.drill.exec.rpc.RpcException: Failure setting up *
    >
    > *ZK for client.*
    >
    >
    >
    >
    >
    >
    >
    > [image: cid:image001.png@01D3B9E9.23323D90]
    >
    > *Tushar Bhalchandra Pathare*
    >
    > Bigdata,GPFS,CSXF – Research Department
    >
    > *t. *+974 4003 7443
    >
    > *m.* +974 74793547
    >
    > PO BOX 26999 Doha, Qatar
    >
    > sidra.org
    > 
<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.sidra.org_&d=DwMGaQ&c=cskdkSMqhcnjZxdQVpwTXg&r=H5JEl9vb-mBIjic10QAbDD2vkUUKAxjO6wZO322RtdI&m=xCohfm7_vub0ExT6cMTEbB4WbjdIEPLdaXqXAOANq4A&s=kqudpk5v3cRasIbaMG8kwLBXafZ87VEhutJj7vxwhS4&e=>
    >
    >
    > Disclaimer: This email and its attachments may be confidential and are
    > intended solely for the use of the individual to whom it is addressed. If
    > you are not the intended recipient, any reading, printing, storage,
    > disclosure, copying or any other action taken in respect of this e-mail is
    > prohibited and may be unlawful. If you are not the intended recipient,
    > please notify the sender immediately by using the reply function and then
    > permanently delete what you have received. Any views or opinions expressed
    > are solely those of the author and do not necessarily represent those of
    > Sidra Medical and Research Center.
    >


Disclaimer: This email and its attachments may be confidential and are intended 
solely for the use of the individual to whom it is addressed. If you are not 
the intended recipient, any reading, printing, storage, disclosure, copying or 
any other action taken in respect of this e-mail is prohibited and may be 
unlawful. If you are not the intended recipient, please notify the sender 
immediately by using the reply function and then permanently delete what you 
have received. Any views or opinions expressed are solely those of the author 
and do not necessarily represent those of Sidra Medical and Research Center.

Reply via email to