What is transaction?
Transaction is a logical unit of work where all operation should success or nothing should success.
Or you can understand as below
A transaction is a set of one or more SQL statements that is executed as a unit either all statements will be executed successfully or none of them.
You can visit JDBC transaction management example for better clarity.