[Progress Communities] [Progress OpenEdge ABL] Forum Post: Pivotal Greenplum 6.0.0 batch insert

Status
Not open for further replies.
D

degeorge

Guest
I had Pivotal GP 6.0.0 version and DataDirect JDBC driver 5.1.4 distributed by pivotal. When i trying to use batch inserts via jdbc, rows are sending one by one as separate single inserts. Wireshark shows that for each addBatch method driver creates new bind and execute postgres protocol instructions then database response with bind completion and command completion (Tag: INSERT 0 1) for each row. So it is how single inserts work. Simple java code: Connection connection = DriverManager.getConnection(url, props); connection.setAutoCommit(false); String sql = "INSERT INTO test VALUES (?)"; PreparedStatement statement = connection.prepareStatement(sql); int batchSize = 1000; Random random = new Random(); for (int i = 0; i < batchSize; i++) { long ts = random.nextLong(); statement.setLong(1, ts); statement.addBatch(); } statement.executeBatch(); connection.commit(); So the question is - does this is expected behavior and batch inserts not working or i must use driver in another way?

Continue reading...
 
Status
Not open for further replies.
Top