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, your idea did indeed help for my basic scenario.
For reference, I'm using the latest build (freshly updated master branch) and it seems the HBase stuff is partially broken at this point. The file I had to update was $DRILL_DIR/exec/java-exec/src/main/resources/bootstrap-storage-plugins.json.
On 06/20/2014 05:29 PM, Neeraja Rentachintala wrote:
NEW: Monitor These Apps!
Apache Lucene, Apache Solr and all other Apache Software Foundation projects and their respective logos are trademarks of the Apache Software Foundation.
Elasticsearch, Kibana, Logstash, and Beats are trademarks of Elasticsearch BV, registered in the U.S. and in other countries. This site and Sematext Group is in no way affiliated with Elasticsearch BV.
Service operated by Sematext