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

Kristine Hahn commented on DRILL-2693:
--------------------------------------

Raj provided the sample code snippet to connect to drill using Drill-Jdbc-all 
Driver.
{code}
Class.forName("org.apache.drill.jdbc.Driver");
Connection connection =DriverManager.getConnection("jdbc:drill:zk=
node3.mynode.com:5181/drill/my_cluster_com-drillbits");
Statement st = connection.createStatement();
ResultSet rs = st.executeQuery("SELECT * from cp.`employee`");
while(rs.next()){
System.out.println(rs.getString(1));
}
{code}

And from Tomer:
{quote}
If you want to connect to a random drillbit in the cluster you would use
ZooKeeper in the connection URL:

jdbc:drill:zk=<zk quorum>/drill/<cluster id>

If you want to connect to a specific drillbit you could specify that
directly by replacing "zk=<zk quorum>" with "drillbit=<node>"
{quote}
I'll add a section to the JDBC doc.

> doc programmatically submit queries to Drill 
> ---------------------------------------------
>
>                 Key: DRILL-2693
>                 URL: https://issues.apache.org/jira/browse/DRILL-2693
>             Project: Apache Drill
>          Issue Type: Task
>          Components: Documentation
>            Reporter: Kristine Hahn
>            Assignee: Kristine Hahn
>
> Document how to start up an embedded Drillbit inside your
> an application. Use a complete JDBC driver (rather than
>  the remote-only driver).
> The standalone jdbc-all driver is designed to be a remote driver.  As such, 
> you must have zookeeper and a separate Drill daemon up and running to 
> leverage it.  If you want to embed a Drillbit inside your application, you'll 
> need to source the same classpath that the drillbit.sh start-up script 
> sources.
> If you just try to use the jdbc jar that gets shipped, you get this exception:
>  java.sql.SQLException: Running Drill in embedded mode using the JDBC jar
> alone is not supported.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to