Connection Object Methods

The APIs used for connection objects.

close()

Closes the connection to the server. The connection is unusable after the call, and raises an exception if any operation is attempted. The same applies to cursor objects attempting to access the connection.

connection.close()
commit()

Executes the command commit.

connection.commit()
rollback()

Executes the command rollback.

connection.rollback()
cursor()

This method constructs a new cursor object using the connection.

connection.cursor()
messages()

This is a Python list object to which the module appends tuples (exception class and exception object) for all messages that the module receives for this connection. An error on any cursor obtained from the same connection object, is appended to the messages attribute of the connection object of the cursor.

connection.messages()

Usage example:

try:
    cur.execute("select ...")
except sybpydb.Error:
    for err in cur.connection.messages:
        print("Exception %s, Value %s", % err[0], err[1])