The transaction is a set of Sql statement that can be executed as a single unit.the transaction is complete only when all the sql statements in a transaction excute successfully.if any one of the sql statement in the transaction fails the entire transaction is rolled back. paste the code inside the main method import java.sql.*; public class Transaction { public …