I don't know what is better to use Start Transaction OR Begin Work, and what is the difference.
2 Answers
From the MySQL manual:
BEGIN
andBEGIN WORK
are supported as aliases ofSTART TRANSACTION
for initiating a transaction.START TRANSACTION
is standard SQL syntax and is the recommended way to start an ad-hoc transaction.

- 122,705
- 18
- 212
- 237
-
Good, But i have a problem when run tow clients of my java application on the network, first client insert a record second client can see it when refreshing the resultset, now when 2nd client insert a new record the first client can't see that record even after refreshing, when the first client close the application and re run it, record from the 2nd client show normally !!!!! so what happened ? how can i monitor both of them to trace my problem ? Note: when setting AutoCommit true after COMMIT, every thing just work fine. do i need any extra configuration on my.cnf ?? – Motasem May 04 '12 at 22:23
This is updated answer from MySQL 8.0 manual:
BEGIN ... END syntax is used for writing compound statements, which can appear within stored programs (stored procedures and functions, triggers, and events).
This means that BEGIN ... END syntax is used only to structure your code and to enable nesting (this blocks can be nested). Later in the manual:
Within all stored programs, the parser treats BEGIN [WORK] as the beginning of a BEGIN ... END block. To begin a transaction in this context, use START TRANSACTION instead.
This means that BEGIN/BEGIN WORK are aliases for BEGIN in BEGIN ... END syntax and they are not aliases from START TRANSACTION. In stored procedures, functions, triggers and events you should always use START TRANSACTION to start a transaction.

- 97
- 11