Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » UltraLite - Java Programming » UltraLiteJ application development » Quick start guide to schema operations and data management

 

Row operation management

Manage row operations by performing the following general tasks:

  1. Construct a SQL statement in a String variable.

  2. Create a PreparedStatement object by passing the String variable to the Connection.prepareStatement method.

  3. 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.

  4. Call the PreparedStatement.execute method to perform the operation on the database.

  5. 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.

  6. Close the PreparedStatement object to free resources.

 Example
 See also