Relational databases support the facility of a two phase commit. That is, any changes made to the database require that a commit is requested before the session is disconnected. If the session is disconnected without a commit, then the changes are unwound and discarded leaving the database in the state it was in after the previous commit.
Sometimes people place a commit after every transaction. This is somewhat wasteful and can lead to low performance. Placing a commit every 25 or so transactions is better.
You do need to be sure that you have made the changes you need to and that any referential integrity is maintained and any constraints on the data are satisfied, otherwise the commit may fail.