Cursors

Methods for creating a cursor using jConnect.

  • SybStatement.setCursorName – assigns explicitly the cursor a name.

    The signature for SybStatement.setCursorName is:
    void setCursorName(String name) throws SQLException;
  • SybStatement.setFetchSize – creates a cursor and specifies the number of rows returned from the database in each fetch.

    The signature for SybStatement.setFetchSize is:
    void setFetchSize(int rows) throws SQLException;

    When you use setFetchSize to create a cursor, the jConnect driver names the cursor. To get the name of the cursor, use ResultSet.getCursorName.

Another way you can create cursors is to specify the kind of ResultSet you want returned by the statement, using this JDBC method on the connection:
Statement createStatement(int resultSetType, int resultSetConcurrency)throws SQL Exception

If you request an unsupported ResultSet, a SQL warning is chained to the connection. When the returned Statement is executed, you receive the kind of ResultSet that is most like the one you requested. See the JDBC Specification for more details on the behavior of this method.

If you do not use createStatement, the default types of ResultSet are:
  • If you call only Statement.executeQuery, the ResultSet returned is a SybResultSet that is TYPE_FORWARD_ONLY and CONCUR_READ_ONLY.

  • If you call setCursorName, the ResultSet returned from executeQuery is a SybCursorResultSet that is TYPE_FORWARD_ONLY and CONCUR_UPDATABLE.

  • If you call setFetchSize, the ResultSet returned from executeQuery is a SybCursorResultSet that is TYPE_FORWARD_ONLY and CONCUR_READ_ONLY.

To verify the kind of ResultSet object is what you intended, use these two ResultSet methods:
int getConcurrency() throws SQLException;
int getType() throws SQLException;