Member since
08-31-2016
5
Posts
3
Kudos Received
1
Solution
My Accepted Solutions
Title | Views | Posted |
---|---|---|
3815 | 09-01-2016 08:25 AM |
09-01-2016
08:25 AM
2 Kudos
I was able to switch to the Impala JDBC4 2.5.32 version of the driver and the prepared statement behavior is what I expect with that one.
... View more
08-31-2016
12:10 PM
Using the Impala JDBC driver, I'm getting an exception when trying to use a prepared statement more than once. The first execute works, and the second doesn't. Here's my code snippet: PreparedStatement stmt = null; try { stmt = conn.prepareStatement("select * from hbase_vm_customer where cas_id=?"); } catch (SQLException e) { e.printStackTrace(); } try { stmt.setString( 1, "155304611"); ResultSet rs = stmt.executeQuery(); if( !rs.next() ) { System.out.println( "missing row" ); } else { System.out.println( rs.getString(1) ); } rs.close(); } catch (SQLException e) { e.printStackTrace(); } try { stmt.setString( 1, "155304612"); ResultSet rs = stmt.executeQuery(); if( !rs.next() ) { System.out.println( "missing row for " ); } else { System.out.println( rs.getString(1) ); } } catch (SQLException e) { e.printStackTrace(); } Here's the stack trace: 155304611 java.sql.SQLException: [JDBC Driver]Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(ArrayList.java:653) at java.util.ArrayList.get(ArrayList.java:429) at com.cloudera.impala.jdbc.common.SPreparedStatement.getInputParameterValues(SPreparedStatement.java:3313) at com.cloudera.impala.jdbc.common.SPreparedStatement.getInputParameterValues(SPreparedStatement.java:3268) at com.cloudera.impala.jdbc.common.SPreparedStatement.executeQuery(SPreparedStatement.java:1070) at imptest.ImpExample.main(ImpExample.java:50) Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 ... 6 more This is a query against an Hbase table, and I'm using Cloudera_ImpalaJDBC4_2.5.5.1007 jdbc driver. Any suggestions would be appreciated.
... View more
Labels:
- Labels:
-
Apache HBase
-
Apache Impala