JDBC T2 : Batch execute with prepared insert stmt containing multiple rows fails

Bug #1315527 reported by Aruna Sadashiva
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Trafodion
In Progress
Wishlist
Sandhya Sundaresan

Bug Description

With JDBC T2/T4 driver executeBatch of prepared insert with multiple rows fails with the exception below. Same test works on SQ.

sql : insert into " + IN1 + " values(?,?,?,?),(?,?,?,?),(?,?,?,?)";

Batch10 : ERROR: Exception in insert batch mode.....
java.sql.BatchUpdateException: The message id: batch_command_failed
        at org.trafodion.jdbc.t4.TrafT4PreparedStatement.executeBatch(TrafT4PreparedStatement.java:307)
        at TestBatch.JDBCBatch10(TestBatch.java:86)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at org.junit.runners.Suite.runChild(Suite.java:127)
        at org.junit.runners.Suite.runChild(Suite.java:26)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at org.junit.runners.Suite.runChild(Suite.java:127)
        at org.junit.runners.Suite.runChild(Suite.java:26)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:128)
        at org.junit.runner.JUnitCore.runClasses(JUnitCore.java:73)
        at TestRunner.main(TestRunner.java:8)
The message id: batch_command_failed

Changed in trafodion:
assignee: nobody → Kevin Xu (kai-hua-xu)
Revision history for this message
Pavani Puppala (pavani-puppala) wrote :

Lowering the priority as the test case is not very common and not a priority.

Changed in trafodion:
importance: High → Medium
information type: Proprietary → Public
Changed in trafodion:
importance: Medium → Low
Kevin Xu (kai-hua-xu)
Changed in trafodion:
assignee: Kevin Xu (kai-hua-xu) → xiu-zhu.zhang (xiu-zhu-zhang)
Changed in trafodion:
status: New → In Progress
Changed in trafodion:
status: In Progress → New
Changed in trafodion:
milestone: none → r2.0
Changed in trafodion:
status: New → In Progress
Changed in trafodion:
status: In Progress → New
Changed in trafodion:
status: New → In Progress
Revision history for this message
xiu-zhu.zhang (xiu-zhu-zhang) wrote :

JDBC_TYPE4:
Batch operation failed by statement of 'insert into table values(?,?,?,?),(?,?,?,?),(?,?,?,?)' on below loop over one time;

The procedure:
PreparedStatement pStmt = null;
insert = "insert into table values(?,?,?,?),(?,?,?,?),(?,?,?,?)";
for (int j = 0; j < 1; j++) {
                pStmt.setString(1, "QA");
                pStmt.setInt(2, prm);
                pStmt.setInt(3, points);
                pStmt.setString(4, DEPT);

                pStmt.setString(5, "QA");
                pStmt.setInt(6, prm);
                pStmt.setInt(7, points);
                pStmt.setString(8, DEPT);

                pStmt.setString(9, "QA");
                pStmt.setInt(10, prm);
                pStmt.setInt(11, points);
                pStmt.setString(12, DEPT);

                pStmt.addBatch();
}
pStmt.executeBatch();
This scenario will insert three records into table on loop one time.

On the side it will failed on pStmt.addBatch() over one time.
Here is the error from SQL side:
ERROR[30025] The ATOMIC and NOT ATOMIC clauses can be used only in a rowset INSERT statement.

Changed in trafodion:
assignee: xiu-zhu.zhang (xiu-zhu-zhang) → Sandhya Sundaresan (sandhya-sundaresan)
Revision history for this message
Chen-Yun Fan (chen-yun-fan) wrote :

I changed the Importance to wishlist and removed the Target Milestone based on Anu's request.

Changed in trafodion:
importance: Low → Wishlist
milestone: r2.0 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.