How to Commit Sql Queryin JAVA

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rajamohammed
    New Member
    • Jul 2007
    • 11

    How to Commit Sql Queryin JAVA

    Hi, I using Oracle Database connection in Java and I run "DELETE" sql query .
    In oracle, we will use commit command after every transaction. Please tell me, How can I use commit in Java? Should we commit after every transaction?
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by rajamohammed
    Hi, I using Oracle Database connection in Java and I run "DELETE" sql query .
    In oracle, we will use commit command after every transaction. Please tell me, How can I use commit in Java? Should we commit after every transaction?
    Have a look at the API documentation of the Connection interface and pay
    special attention to the commit() and setAutoCommit() methods.

    It depends on your transactions when and where and how to commit; i.e. you
    have to define your 'unit of work'; after every such unit you should commit. Such
    a unit isn't necessarily a single sql statement.

    kind regards,

    Jos

    Comment

    Working...