what is the function of "commit" ?

hello

I would like to ask a specifc question about commit !!!!

I have a desktop application that connect to the database

lets say that in the application ,I have a method called

insert_user()

{

insert into .....

....

}

and i have another metond called

commit_changes()

{

commit();

if i have 2 clients that lanched the programme at the same time

programe 1 made the folloing methods

insert_client ()

...

....

programe2 used the foloowing methods

insert_user

commit_changes()

and here come the question ...

is the commit of programme 2 has effect on the info or the user insert of programe 1 ? I mean is it going to commit the info of the first programme ?

thank you in advance

[904 byte] By [linuxchilda] at [2007-11-26 15:23:30]
# 1

Usually, the idea of commit means no one can see what you are doing until you have commited. And, once you have commited you can't "undo". That's a very simplistic explanation.

So, if insert a record you will not be able to see it until I have performed a commit. If I choose not to commit I can rollback in which case it will be like the data I inserted never existed.

Ted.

ted_trippina at 2007-7-8 21:38:45 > top of Java-index,Java Essentials,Java Programming...
# 2
ok I agree with u ,but does the commit belong to the user session ? or it belong to entire database ?you see what I mean ?
linuxchilda at 2007-7-8 21:38:45 > top of Java-index,Java Essentials,Java Programming...
# 3
> ok I agree with u ,> but does the commit belong to the user session ? connection/user session.
cotton.ma at 2007-7-8 21:38:45 > top of Java-index,Java Essentials,Java Programming...
# 4
ok thank you
linuxchilda at 2007-7-8 21:38:45 > top of Java-index,Java Essentials,Java Programming...
# 5
It also involves isolation level and locking. Commit doesn't do it alone. That's just how ACID is maintained.Could be "databases" if you're using an XA driver and two-phase commit.%
duffymoa at 2007-7-8 21:38:45 > top of Java-index,Java Essentials,Java Programming...
# 6
Also note that in JDBC, I think autocommit is on by default, meaning every statement is commited as soon as it's executed. You'll want to set autoCommit to false on the Connection to enable rollbacks and explicit commits.
jverda at 2007-7-8 21:38:45 > top of Java-index,Java Essentials,Java Programming...