When you commit a transaction, you persist all changes performed in the transaction, delete the savepoints, and release all transaction locks.
To explicitly commit a transaction, use either the COMMIT statement or click the Commit button in the graphic user interface (GUI) tool. Note
OceanBase issues an implicit COMMIT statement before and after a DML statement, which also commits a transaction.
Before you commit a transaction:
Your changes are visible to the current session, not others.
Your changes are not final and you can roll them back with a ROLLBACK statement.
After you commit a transaction:
Your changes are visible to all database sessions.
Your changes are persisted and you cannot roll them back with a ROLLBACK statement.
Example: Committing a transaction
obclient> INSERT INTO t_insert(id,name) VALUES(4,'JP');
Query OK, 1 row affected (0.01 sec)
obclient> COMMIT;
Query OK, 0 rows affected (0.00 sec)
obclient> ^Bye
[qing.meiq@h07g12088.sqa.eu95 /home/qing.meiq/bmsql]
$obclient -h192.168.0.0 -utpcc@obbmsql#obdemo -P2883 -p**1*** TPCC
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
obclient> SELECT * FROM t_insert;
+----+------+-------+---------------------+
| ID | NAME | VALUE | GMT_CREATE |
+----+------+-------+---------------------+
| 1 | CN | 10001 | 2020-04-02 17:52:31 |
| 2 | US | 10002 | 2020-04-02 17:52:38 |
| 3 | EN | 10003 | 2020-04-02 17:52:38 |
| 4 | JP | NULL | 2020-04-02 17:53:34 |
+----+------+-------+---------------------+
4 rows in set (0.00 sec)