DBAsupport.com Forums - Powered by vBulletin
Results 1 to 8 of 8

Thread: why must commit?

  1. #1
    Join Date
    Sep 2001
    Posts
    99
    in sql*plus or sql*worksheet, I insert a record into a table.
    If I don't commit, in another sql*plus window I can't select the record which I'v just inserted. Why must commit?
    If I insert records through using JDBC, Need I commit?
    ocean

  2. #2
    Join Date
    Feb 2001
    Location
    Paris, France
    Posts
    809
    Wow boy ...
    well, the concept of commit is essential in Oracle because of the data integrity, which must ALWAYS be respected.
    If you make any change on the data (not on the structures), using INSERT, UPDATE, or DELETE, no change is validated (that is to say you are the only one who sees changes you made) until you either COMMIT (validate the changes) or ROLLBACK (cancel changes).
    So when you make changes and you are sure of what you made, you can commit, and everybody can then see your changes.

  3. #3
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    Originally posted by oceanju
    in sql*plus or sql*worksheet, I insert a record into a table.
    If I don't commit, in another sql*plus window I can't select the record which I'v just inserted. Why must commit?

    http://technet.oracle.com/docs/produ...intro.htm#9281
    Jeff Hunter

  4. #4
    Join Date
    Sep 2001
    Posts
    99

    if I change data through JDBC, must I commit?

    I want that if i execute one sql statement, the effect can be known by every user. I want "commit" is a default behavior.
    I make website in JSP. JSP connects Oracle through JDBC. In JDBC, I execute one sql statement, must I execute "commit" statement?
    ocean

  5. #5
    Join Date
    Feb 2001
    Location
    Paris, France
    Posts
    809
    before wishing to commit everything, you should have a look at Oracle Documentation, especially at the Concepts book ... it should lighten some dark points

  6. #6
    Join Date
    Oct 2000
    Location
    Germany
    Posts
    1,185

    In DB2, it is possible to report on data that has not been committed. This poses a whole new set of problems if the uncommitted changes are backed out.

    Can you imagine doing accounting reports from a database allowing "dirty reads"?
    David Knight
    OCP DBA 8i, 9i, 10g

  7. #7
    Join Date
    Sep 2001
    Posts
    99

    thank you

    I know the transaction must commit. But for example, in sql server, one sql statement is in one transaction. You needn't declare transaction in evidence. If a sql statement is executed sucessfully, the transaction commit automatically. You needn't execute one additional sql statement "commit" to commit the transaction. If you execute two or more sql statements and you want these statement in one transaction, you must declare transaction and commit it in evidence. If one sql statement executes failure, all sql statements which have executed will rollback automatically.
    ocean

  8. #8
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    what do you want? something you cannot undo or something that can?
    in SQL server if you want a transaction that can be rollback you have to declare before you start transaction, I would rather write commit at the end instead of declaring at front and commit at end

    From a visual tool like developer the insert/update/ordelete is atomic with commit which makes sense, why should they be in some command tool like sql*plus?

    In Oracle if I do 10 transactions then commit at the end I commit all 10 transactions

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width