Transaction's role:
For example
General format.
Try
{
Conn.setautocommit (false);
Statement stat = conn.createstatement ();
Stat.executeUpdate (Command1);
Stat.executeUpdate (Command2);
Stat.executeUpdate (Command3);
.
Stat.Addbatch (Command);
It can be replaced in the above.
/ *
While (....)
{
Command = "INSERT INTO... VALUES (" ... ")"
Stat.Addbatch (Command);
}
int [] counts = stat.executebatch ();
* /
CONN.COMMIT ();
} catch (SQLEXCEPTION EXP)
{
CONN. ROLLBACK ();
}
FINNALLY
{
CONN.CLOSE ();
}