You can actually use DrillClient class directly that talks protobuf directly with drillbit.
Tim Sent from my iPhone > On Jun 20, 2014, at 7:33 AM, Miroslav Cupak <[email protected]> wrote: > > Hi folks, > > I'm trying to figure out how to connect to Drill programmatically from > Java (using JDBC). Let's assume I want to connect to a drillbit started > externally and query some parquet files stored locally, without using > distributed mode at this point. Could anyone please point me to or share > an example showing how to do this? > > Since I haven't found any tutorial on the wiki or anywhere else, I tried > to replicate the approach from the JdbcTestQueryBase - use > org.apache.drill.exec/drill-jdbc as the dependency in my project and > obtain the connection from > DriverManager.getConnection(jdbc:drill:zk=local, null) after > Driver.load(). However, my connection is null and I get the following > exception when I try to use it: > > SEVERE: null > java.sql.SQLException: Failure while attempting to start Drillbit in > embedded mode. > ... > Caused by: java.lang.RuntimeException: > com.fasterxml.jackson.databind.JsonMappingException: Could not resolve > type id 'hbase' into a subtype of [simple type, class > org.apache.drill.common.logical.StoragePluginConfig] > at [Source: [B@4dd987b2; line: 2, column: 3] > ... > Caused by: com.fasterxml.jackson.databind.JsonMappingException: Could > not resolve type id 'hbase' into a subtype of [simple type, class > org.apache.drill.common.logical.StoragePluginConfig] > at [Source: [B@4dd987b2; line: 2, column: 3] > ... > Exception in thread "main" java.lang.NullPointerException > > It should be noted that I'm not even interested in running an embedded > drillbit or using HBase. Maybe I'm using a wrong entry point completely, > I can see some other possibly relevant classes (e.g. DrillClient), but > I'm not sure if that's the way to go. Any help would be much appreciated. > > Thank you, > Miro
