skip to main content
Using DataDirect Test : DataDirect Test Tutorial : Batch Execution on a Prepared Statement
 

Batch Execution on a Prepared Statement

Batch execution on a prepared statement allows you to update or insert multiple records simultaneously. In some cases, this can significantly improve system performance because fewer round-trips to the database are required.
NOTE: Batch execution on a prepared statement is supported by the JDBC 2.0 and higher specifications and requires a Java 2 Platform (J2SE 1.4 or higher)-compatible Java Virtual Machine.
1. From the Connection window menu, select Connection / Create Prepared Statement.
2. Specify the Insert statement that you want to execute.
Click Submit; then, click Close.
3. Select Statement / Add Stmt Batch.
4. For each parameter:
a. Type the parameter number.
b. Select the parameter type.
c. Type the parameter value.
d. Click Set.
5. Click Add to add the specified set of parameters to the batch. To add multiple parameter sets to the batch, repeat Step 3 through Step 5 as many times as necessary. When you are finished adding parameter sets to the batch, click Close.
6. Select Statement / Execute Stmt Batch. DataDirect Test displays the rowcount for each of the elements in the batch.
7. If you re-execute the Select statement from Executing a Simple Select Statement, you see that the previously inserted records are returned.
.