You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@drill.apache.org by George Lu <lu...@gmail.com> on 2015/05/24 17:03:26 UTC

Can I use drill-jdbc-.jar in java client to query

Hi all,

In addition to Drill Restful API, can I use jars/drill-jdbc-<version>.jar
in JAVA client to query? I don't find any documentation of which class I
can use. If possible, can someone show me?

Thanks!

Regards,
George Lu

Re: Can I use drill-jdbc-.jar in java client to query

Posted by Aditya <ad...@gmail.com>.
George,

Please make sure that you use
"jars/jdbc-driver/drill-jdbc-all-<version>.jar" and not "
jars/drill-jdbc-<version>.jar". The former jar has all the Drill client and
supplementary code along with the JDBC API implementation embedded inside
it while the later only contains JDBC API implementation.

aditya...

On Sun, May 24, 2015 at 8:03 AM, George Lu <lu...@gmail.com> wrote:

> Hi all,
>
> In addition to Drill Restful API, can I use jars/drill-jdbc-<version>.jar
> in JAVA client to query? I don't find any documentation of which class I
> can use. If possible, can someone show me?
>
> Thanks!
>
> Regards,
> George Lu
>

Re: Can I use drill-jdbc-.jar in java client to query

Posted by Rajkumar Singh <rs...@maprtech.com>.
Hi George

I will suggest you to put the drill-jdbc jar into your class path and use java-jdbc connectivity to open a connection,execute a query and get the results. 

Class.forName("org.apache.drill.jdbc.Driver”) // load the jdbc driver
Connection connection = DriverManager.getConnection(“"jdbc:drill:zk=x.x.x.:5181,x.x.x.x:5181,x.x.x.x:5181/drill/cluster-id;schema=dfs"”); // get the connection from driver manager
statement = connection.createStatement(); // create statement
resultSet = statement.executeQuery(query);

get ResultSetMetaData from ResultSet to know the return columns from the cursor and appropriately get the values using the ResultSet.

Rajkumar Singh
MapR Technologies


> On May 24, 2015, at 8:33 PM, George Lu <lu...@gmail.com> wrote:
> 
> Hi all,
> 
> In addition to Drill Restful API, can I use jars/drill-jdbc-<version>.jar
> in JAVA client to query? I don't find any documentation of which class I
> can use. If possible, can someone show me?
> 
> Thanks!
> 
> Regards,
> George Lu