skip to main content
DataDirect tools : DataDirect Test : DataDirect Test tutorial : Batch execution on a prepared statement
  

Try DataDirect Drivers Now
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.
To execute a batch on a prepared statement:
1. From the Connection window menu, select Connection / Create Prepared Statement.
Type an Insert statement and click Submit. Then, click Close.
Get Prepared Statement SQL window with SQL statement
2. Select Statement / Add Stmt Batch.
3. For each parameter:
a. Type the parameter number.
b. Select the parameter type.
c. Type the parameter value.
d. Click Set.
Set Batch Parameters window with type and value information
4. Click Add to add the specified set of parameters to the batch. To add multiple parameter sets to the batch, repeat Step 2 through Step 4 as many times as necessary. When you are finished adding parameter sets to the batch, click Close.
5. Select Statement / Execute Stmt Batch. DataDirect Test displays the rowcount for each of the elements in the batch.
Connection window indicating update count
6. If you re-execute the Select statement from "Executing a simple Select statement," you see that the previously inserted records are returned.
Connection window showing updated table