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.
![]() |
Discuss this page in DocCommentXchange.
|
Copyright © 2014, SAP AG or an SAP affiliate company. - SAP Sybase SQL Anywhere 16.0 |