This is my own Generated code which I am using to connect to Drill via JDBC and query *.csv file on my cloudera sandbox.
Code:
try{
Class.forName(“org.apache.drill.jdbc.Driver”);
Connection connection =DriverManager.getConnection(“jdbc:drill:zk=localhost:2181″,”root”,”cloudera”);
Statement st = connection.createStatement();
ResultSet rs = st.executeQuery(“SELECT * from dfs.`/home/cloudera/Desktop/test.csv`”);
while(rs.next()){
System.out.println(rs.getString(1));
…..
}
}catch(Exception e){
//Handle errors
e.printStackTrace();
}
(more…)