<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Impala Prepared Statement Exception when statement executed second time in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Impala-Prepared-Statement-Exception-when-statement-executed/m-p/44600#M39273</link>
    <description>&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PreparedStatement stmt = null;&lt;BR /&gt;try {&lt;BR /&gt;stmt = conn.prepareStatement("select * from hbase_vm_customer where cas_id=?");&lt;BR /&gt;} catch (SQLException e) {&lt;BR /&gt;e.printStackTrace();&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;try {&lt;BR /&gt;stmt.setString( 1, "155304611");&lt;BR /&gt;ResultSet rs = stmt.executeQuery();&lt;BR /&gt;if( !rs.next() ) {&lt;BR /&gt;System.out.println( "missing row" );&lt;BR /&gt;}&lt;BR /&gt;else {&lt;BR /&gt;System.out.println( rs.getString(1) );&lt;BR /&gt;}&lt;BR /&gt;rs.close();&lt;BR /&gt;} catch (SQLException e) {&lt;BR /&gt;e.printStackTrace();&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;try {&lt;BR /&gt;stmt.setString( 1, "155304612");&lt;BR /&gt;ResultSet rs = stmt.executeQuery();&lt;BR /&gt;if( !rs.next() ) {&lt;BR /&gt;System.out.println( "missing row for " );&lt;BR /&gt;}&lt;BR /&gt;else {&lt;BR /&gt;System.out.println( rs.getString(1) );&lt;BR /&gt;}&lt;BR /&gt;} catch (SQLException e) {&lt;BR /&gt;e.printStackTrace();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the stack trace:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;155304611&lt;BR /&gt;java.sql.SQLException: [JDBC Driver]Index: 0, Size: 0&lt;BR /&gt;at java.util.ArrayList.rangeCheck(ArrayList.java:653)&lt;BR /&gt;at java.util.ArrayList.get(ArrayList.java:429)&lt;BR /&gt;at com.cloudera.impala.jdbc.common.SPreparedStatement.getInputParameterValues(SPreparedStatement.java:3313)&lt;BR /&gt;at com.cloudera.impala.jdbc.common.SPreparedStatement.getInputParameterValues(SPreparedStatement.java:3268)&lt;BR /&gt;at com.cloudera.impala.jdbc.common.SPreparedStatement.executeQuery(SPreparedStatement.java:1070)&lt;BR /&gt;at imptest.ImpExample.main(ImpExample.java:50)&lt;BR /&gt;Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0&lt;BR /&gt;... 6 more&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a query against an Hbase table, and&lt;/P&gt;&lt;P&gt;I'm using Cloudera_ImpalaJDBC4_2.5.5.1007 jdbc driver.&lt;/P&gt;&lt;P&gt;Any suggestions would be appreciated.&lt;/P&gt;</description>
    <pubDate>Fri, 16 Sep 2022 10:37:29 GMT</pubDate>
    <dc:creator>ohtrekker</dc:creator>
    <dc:date>2022-09-16T10:37:29Z</dc:date>
    <item>
      <title>Impala Prepared Statement Exception when statement executed second time</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Impala-Prepared-Statement-Exception-when-statement-executed/m-p/44600#M39273</link>
      <description>&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PreparedStatement stmt = null;&lt;BR /&gt;try {&lt;BR /&gt;stmt = conn.prepareStatement("select * from hbase_vm_customer where cas_id=?");&lt;BR /&gt;} catch (SQLException e) {&lt;BR /&gt;e.printStackTrace();&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;try {&lt;BR /&gt;stmt.setString( 1, "155304611");&lt;BR /&gt;ResultSet rs = stmt.executeQuery();&lt;BR /&gt;if( !rs.next() ) {&lt;BR /&gt;System.out.println( "missing row" );&lt;BR /&gt;}&lt;BR /&gt;else {&lt;BR /&gt;System.out.println( rs.getString(1) );&lt;BR /&gt;}&lt;BR /&gt;rs.close();&lt;BR /&gt;} catch (SQLException e) {&lt;BR /&gt;e.printStackTrace();&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;try {&lt;BR /&gt;stmt.setString( 1, "155304612");&lt;BR /&gt;ResultSet rs = stmt.executeQuery();&lt;BR /&gt;if( !rs.next() ) {&lt;BR /&gt;System.out.println( "missing row for " );&lt;BR /&gt;}&lt;BR /&gt;else {&lt;BR /&gt;System.out.println( rs.getString(1) );&lt;BR /&gt;}&lt;BR /&gt;} catch (SQLException e) {&lt;BR /&gt;e.printStackTrace();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the stack trace:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;155304611&lt;BR /&gt;java.sql.SQLException: [JDBC Driver]Index: 0, Size: 0&lt;BR /&gt;at java.util.ArrayList.rangeCheck(ArrayList.java:653)&lt;BR /&gt;at java.util.ArrayList.get(ArrayList.java:429)&lt;BR /&gt;at com.cloudera.impala.jdbc.common.SPreparedStatement.getInputParameterValues(SPreparedStatement.java:3313)&lt;BR /&gt;at com.cloudera.impala.jdbc.common.SPreparedStatement.getInputParameterValues(SPreparedStatement.java:3268)&lt;BR /&gt;at com.cloudera.impala.jdbc.common.SPreparedStatement.executeQuery(SPreparedStatement.java:1070)&lt;BR /&gt;at imptest.ImpExample.main(ImpExample.java:50)&lt;BR /&gt;Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0&lt;BR /&gt;... 6 more&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a query against an Hbase table, and&lt;/P&gt;&lt;P&gt;I'm using Cloudera_ImpalaJDBC4_2.5.5.1007 jdbc driver.&lt;/P&gt;&lt;P&gt;Any suggestions would be appreciated.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 10:37:29 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Impala-Prepared-Statement-Exception-when-statement-executed/m-p/44600#M39273</guid>
      <dc:creator>ohtrekker</dc:creator>
      <dc:date>2022-09-16T10:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: Impala Prepared Statement Exception when statement executed second time</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Impala-Prepared-Statement-Exception-when-statement-executed/m-p/44633#M39274</link>
      <description>&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 15:25:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Impala-Prepared-Statement-Exception-when-statement-executed/m-p/44633#M39274</guid>
      <dc:creator>ohtrekker</dc:creator>
      <dc:date>2016-09-01T15:25:50Z</dc:date>
    </item>
  </channel>
</rss>

