Batch Insert In Java – JDBC

http://viralpatel.net/blogs/batch-insert-in-java-jdbc/

Hive doesn’t support addBatch yet

Cloudera Impala JDBC Example
Using Connection URL: jdbc:hive2://gm-cdh-510-pvt-2.com:21050/;auth=noSasl
Running Query: INSERT INTO events_poc(name,favorite_number,favorite_color) VALUES (?,?,?)
java.sql.SQLException: Method not supported
at org.apache.hive.jdbc.HivePreparedStatement.addBatch(HivePreparedStatement.java:72)
at com.cloudera.example.ClouderaImpalaJdbcExample.main(ClouderaImpalaJdbcExample.java:41)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
at java.lang.Thread.run(Thread.java:695)
[INFO] ————————————————————————
[INFO] BUILD SUCCESS
[INFO] ————————————————————————
[INFO] Total time: 2.210 s
[INFO] Finished at: 2014-09-25T23:40:53-06:00
[INFO] Final Memory: 11M/81M
[INFO] ————————————————————————

Advertisements