<?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 Re: Impala JDBC executeBatch() doesn't work for Statements. in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Impala-JDBC-executeBatch-doesn-t-work-for-Statements/m-p/91829#M12320</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/28119"&gt;@Andrew_Sherman&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have accepted this answer but yet one thing bothers me addbatch() is supported so what is the use of addbatch() if I cannot execute it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 20 Jun 2019 07:36:48 GMT</pubDate>
    <dc:creator>punshi</dc:creator>
    <dc:date>2019-06-20T07:36:48Z</dc:date>
    <item>
      <title>Impala JDBC executeBatch() doesn't work for Statements.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Impala-JDBC-executeBatch-doesn-t-work-for-Statements/m-p/91697#M12318</link>
      <description>&lt;P&gt;I wrote a java code to insert few thousand records by creating batch, I was not getting good performance from PreparedStatements so I switched to Statements and see if there is some performance difference.&lt;/P&gt;&lt;P&gt;However after getting error and reading Impala doc I came to know executebatch() is not supported for statements but I am able to use addBatch() so its kind a strange.&lt;BR /&gt;&lt;BR /&gt;Here I am posting some of my code-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    private static Connection connectViaDS() throws Exception {
        Connection connection = null;

        Class.forName("com.cloudera.impala.jdbc41.DataSource");

        connection = DriverManager.getConnection(CONNECTION_URL);

        return connection;

    }



//inside main--

// I have declared all the variables,I have lots of other data as well so it may create more confusion


        try {
            connection = connectViaDS();

            connection.setAutoCommit(false);

            Statement statement = connection.createStatement();


            Timestamp ed = new Timestamp(e_date);
            Timestamp et = new Timestamp(e_time);

            while(counter &amp;lt;total) {

                for (int index = 1; index &amp;lt;= records; index++) {

                    counter++;

                 String stmt_query = "INSERT INTO tbl_mindarray (source_ip,destination_ip,protocol_number" + index +"," +
                         "source_port" + index + ",destination_port" + index + ",packet,volume" + index + ",duration" + index + "," +
                         "pps" + index + ",bps" + index + ",bpp" + index + ",source_latitude,source_longitude," +
                         "source_city,source_country,destination_latitude,destination_longitude ,destination_city ,destination_country ," +
                         "ingress_volume" + index + " ,egress_volume " + index + ",ingress_packet ,egress_packet " + index + ",source_if_index ,destination_if_index," +
                         "source_host,event_date,event_time,_time,flow,year)" + "VALUES ('s_ip','d_ip',234,23,56,556,34,27,46,389,76," +
                         "'123123d','456456c','Damouli','Nepal','234234d','678678c','Mumbai','India',123,456,786,324,544,23,'192.168.1.44'," +
                         "345" + index +",345" + index +",2010" + index +")";

                    statement.addBatch(stmt_query);

                }
                statement.executeBatch();

                statement.clearBatch();

                //connection.commit();

                System.out.println("Counter = "+counter);

                //flag++;


            }&lt;/PRE&gt;&lt;P&gt;My question is how do I executebatch() is its not supported, addbatch() is supported so there must be something to execute it.&lt;BR /&gt;&lt;BR /&gt;Here is the error which I am getting&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;java.sql.SQLException: Error message not found: NOT_IMPLEMENTED. Can't find resource for bundle java.util.PropertyResourceBundle, key NOT_IMPLEMENTED
	at com.cloudera.impala.hivecommon.dataengine.HiveJDBCDataEngine.prepareBatch(Unknown Source)
	at com.cloudera.impala.jdbc.common.SStatement.executeAnyBatch(Unknown Source)
	at com.cloudera.impala.jdbc.common.SStatement.executeBatch(Unknown Source)
	at impala_crt.writeInABatchWithCompiledQuery(impala_crt.java:278)
Caused by: com.cloudera.impala.support.exceptions.GeneralException: Error message not found: NOT_IMPLEMENTED. Can't find resource for bundle java.util.PropertyResourceBundle, key NOT_IMPLEMENTED
	... 4 more&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Somewhere I read each prepared statement creates a file into hdfs so I believe statement should be faster as I can insert all row values using just one statement.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It would be really helpful if someone can share there knowledge on this.&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 14:27:22 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Impala-JDBC-executeBatch-doesn-t-work-for-Statements/m-p/91697#M12318</guid>
      <dc:creator>punshi</dc:creator>
      <dc:date>2022-09-16T14:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: Impala JDBC executeBatch() doesn't work for Statements.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Impala-JDBC-executeBatch-doesn-t-work-for-Statements/m-p/91791#M12319</link>
      <description>&lt;P&gt;If you want to use Statement then I think you just use simple:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Statement statement = connection.createStatement();&lt;BR /&gt;&amp;nbsp;statement.execute("drop table foo");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know in other DBMS there is a lot of optimiazation around jdbc PreparedStatements and batches.&lt;/P&gt;&lt;P&gt;There has not be a lot of emphasis on this in Impala.&lt;/P&gt;&lt;P&gt;As I mention in my other reply there is a tendency to use other means of ingestion for optimal perforamance.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 23:00:35 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Impala-JDBC-executeBatch-doesn-t-work-for-Statements/m-p/91791#M12319</guid>
      <dc:creator>Andrew_Sherman</dc:creator>
      <dc:date>2019-06-19T23:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: Impala JDBC executeBatch() doesn't work for Statements.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Impala-JDBC-executeBatch-doesn-t-work-for-Statements/m-p/91829#M12320</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/28119"&gt;@Andrew_Sherman&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have accepted this answer but yet one thing bothers me addbatch() is supported so what is the use of addbatch() if I cannot execute it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 07:36:48 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Impala-JDBC-executeBatch-doesn-t-work-for-Statements/m-p/91829#M12320</guid>
      <dc:creator>punshi</dc:creator>
      <dc:date>2019-06-20T07:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: Impala JDBC executeBatch() doesn't work for Statements.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Impala-JDBC-executeBatch-doesn-t-work-for-Statements/m-p/91865#M12321</link>
      <description>&lt;P&gt;I agree that is super confusing&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 18:15:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Impala-JDBC-executeBatch-doesn-t-work-for-Statements/m-p/91865#M12321</guid>
      <dc:creator>Andrew_Sherman</dc:creator>
      <dc:date>2019-06-20T18:15:21Z</dc:date>
    </item>
  </channel>
</rss>

