1. Module Interface

Binary( string)
Construct an object holding a binary (long) string value.

Connection( [user, password, dsn, mode, handle, pool, threaded, twophase])
connect( [user, password, dsn, mode, handle, pool, threaded, twophase])
Constructor for creating a connection to the database. Return a Connection object (2). All arguments are optional and can be specified as keyword parameters. The dsn (data source name) is the TNS entry (from the Oracle names server or tnsnames.ora file) or is a string like the one returned from makedsn(). If only one parameter is passed, a connect string is assumed which is to be of the format "user/password@dsn", the same format accepted by Oracle applications such as SQL*Plus. If the mode is specified, it must be one of SYSDBA or SYSOPER which are defined at the module level; otherwise it defaults to the normal mode of connecting. If the handle is specified, it must be of type OCISvcCtx* and is only of use when embedding Python in an application (like PowerBuilder) which has already made the connection. The pool is only valid in Oracle 9i and is a session pool object (5) which is the equivalent of calling pool.acquire(). The threaded attribute is expected to be a boolean expression which indicates whether or not Oracle should use the mode OCI_THREADED to wrap accesses to connections with a mutex. Doing so in single threaded applications imposes a performance penalty of about 10-15% which is why the default is False. The twophase attribute is expected to be a boolean expression which indicates whether or not the attributes should be set on the connection object to allow for two phase commit. The default for this value is also False because of bugs in Oracle prior to Oracle 10g.

Cursor( connection)
Constructor for creating a cursor. Return a new Cursor object (3) using the connection.

NOTE: This method is an extension to the DB API definition.

Date( year, month, day)
Construct an object holding a date value.

DateFromTicks( ticks)
Construct an object holding a date value from the given ticks value (number of seconds since the epoch; see the documentation of the standard Python time module for details).

makedsn( host, port, sid)
Return a string suitable for use as the dsn for the connect() method. This string is identical to the strings that are defined by the Oracle names server or defined in the tnsnames.ora file.

NOTE: This method is an extension to the DB API definition.

SessionPool( user, password, database, min, max, increment, [connectiontype, threaded, getmode=cx_Oracle.SPOOL_ATTRVAL_NOWAIT])
Create a session pool (see Oracle 9i documentation for more information) and return a session pool object (5). This allows for very fast connections to the database and is of primary use in a server where the same connection is being made multiple times in rapid succession (a web server, for example). If the connection type is specified, all calls to acquire() will create connection objects of that type, rather than the base type defined at the module level. The threaded attribute is expected to be a boolean expression which indicates whether or not Oracle should use the mode OCI_THREADED to wrap accesses to connections with a mutex. Doing so in single threaded applications imposes a performance penalty of about 10-15% which is why the default is False.

NOTE: This method is an extension to the DB API definition and is only available in Oracle 9i.

Time( hour, minute, second)
Construct an object holding a time value.

TimeFromTicks( ticks)
Construct an object holding a time value from the given ticks value (number of seconds since the epoch; see the documentation of the standard Python time module for details).

Timestamp( year, month, day, hour, minute, second)
Construct an object holding a time stamp value.

TimestampFromTicks( ticks)
Construct an object holding a time stamp value from the given ticks value (number of seconds since the epoch; see the documentation of the standard Python time module for details).



Subsections