InterviewSolution
| 1. |
How Can I Insert Multiple Rows Into A Database In A Single Transaction? |
|
Answer» Answer :
//turn off the IMPLICIT commit a new transaction is implicitly started. JDBC 2.0 provides a set of methods for EXECUTING a BATCH of database commands. Specifically, the java. sql. Statement interface provides three methods: addBatch(), clearBatch() and executeBatch(). Their documentation is pretty straight forward. The implementation of these methods is optional, so be SURE that your driver supports these.
a new transaction is implicitly started. JDBC 2.0 provides a set of methods for executing a batch of database commands. Specifically, the java. sql. Statement interface provides three methods: addBatch(), clearBatch() and executeBatch(). Their documentation is pretty straight forward. The implementation of these methods is optional, so be sure that your driver supports these.
|
|