Manage row operations by performing the following general tasks:
Construct a SQL statement in a String variable.
Create a PreparedStatement object by passing the String variable to the Connection.prepareStatement method.
Set any host variables, indicated by the ? character, by using the PreparedStatement.set method.
Each host variable can be referenced in accordance to its ordinal position in the statement. For example, the first ? is referenced as 1, and the second as 2. The set method, illustrated in the example below, allows you to reference the ordinal position of the variable and specify a new value.
Call the PreparedStatement.execute method to perform the operation on the database.
Commit the changes to the database by calling the Connection.commit method to make the changes permanent; otherwise, call the Connection.rollback method.
Transactions must be explicitly committed or rolled back by using the methods supported by the Connection interface.
Close the PreparedStatement object to free resources.
Discuter à propos de cette page dans DocCommentXchange.
|Copyright © 2013, SAP AG ou société affiliée SAP - SAP Sybase SQL Anywhere 16.0|