- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Impala Prepared Statement Exception when statement executed second time
- Labels:
-
Apache HBase
-
Apache Impala
Created on ‎08-31-2016 12:10 PM - edited ‎09-16-2022 03:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Created ‎09-01-2016 08:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Created ‎09-01-2016 08:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
