ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Multiple SQL calls and then commit over JDBC?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple SQL calls and then commit over JDBC?

    I have a Java application running on a separate system that needs to call a set of IBMi SQL procedures over a JDBC connection. I would like all of that to run under a single commitment control. Is that possible? I would guess so, since it's over a single connection and therefore it's all handled by the same job.

    E.g.

    IBMi SQL procedure A writes a record to table A1
    IBMi SQL procedure B writes a record to table B1
    IBMi SQL procedure C writes a record to table C1
    IBMi SQL procedure D does an SQL commit

    Java establishes an SQL connection over JDBC
    Then over that connection it calls procedure A, then B 5 times, then C
    Then it calls procedure D, which commits all the changes made by A, B, and C

    Would that work?

  • #2
    That should work, Vector. I haven't done it with Java, but I've done the same thing in other contexts.

    The important thing is that the controlling routine, in your case the Java program, controls commit and rollback.

    Comment


    • #3
      Seems to me this is the purpose of doing committment control, to allow multiple things to be treated as a single transaction. Are you having trouble?

      Comment


      • #4
        Thanks all

        Scott - no, but this is the first time I will be trying commitment control over a remote JDBC connection. I figured it would work, but wanted to verify I wasn't missing anything.

        Comment

        Working...
        X