python-cx_Oracle/html/module.html
Anthony Tuininga 259c468302 Use new version of Sphinx (one used with Python 2.6 documentation) to generate
documents; add documentation for new variable attributes; bump copyright into
2009.
2009-01-06 20:54:24 +00:00

849 lines
49 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Module Interface &mdash; cx_Oracle v5.0 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '5.0',
COLLAPSE_MODINDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: false
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="top" title="cx_Oracle v5.0 documentation" href="index.html" />
<link rel="next" title="Connection Object" href="connection.html" />
<link rel="prev" title="cx_Oracle" href="index.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="modindex.html" title="Global Module Index"
accesskey="M">modules</a> |</li>
<li class="right" >
<a href="connection.html" title="Connection Object"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="index.html" title="cx_Oracle"
accesskey="P">previous</a> |</li>
<li><a href="index.html">cx_Oracle v5.0 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="module-interface">
<span id="module"></span><span id="module-cx_Oracle"></span><h1>Module Interface<a class="headerlink" href="#module-interface" title="Permalink to this headline"></a></h1>
<dl class="function">
<dt id="cx_Oracle.Binary">
<!--[cx_Oracle.Binary]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">Binary</tt><big>(</big><em>string</em><big>)</big><a class="headerlink" href="#cx_Oracle.Binary" title="Permalink to this definition"></a></dt>
<dd>Construct an object holding a binary (long) string value.</dd></dl>
<dl class="function">
<dt id="cx_Oracle.clientversion">
<!--[cx_Oracle.clientversion]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">clientversion</tt><big>(</big><big>)</big><a class="headerlink" href="#cx_Oracle.clientversion" title="Permalink to this definition"></a></dt>
<dd><p>Return the version of the client library being used as a 5-tuple. The five
values are the major version, minor version, update number, patch number and
port update number.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This method is an extension to the DB API definition and is only
available in Oracle 10g Release 2 and higher.</p>
</div>
</dd></dl>
<dl class="function">
<dt id="cx_Oracle.Connection">
<!--[cx_Oracle.Connection]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">Connection</tt><big>(</big><span class="optional">[</span><em>user</em>, <em>password</em>, <em>dsn</em>, <em>mode</em>, <em>handle</em>, <em>pool</em>, <em>threaded</em>, <em>twophase</em>, <em>events</em>, <em>cclass</em>, <em>purity</em>, <em>newpassword</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#cx_Oracle.Connection" title="Permalink to this definition"></a></dt>
<dt id="cx_Oracle.connect">
<tt class="descclassname">cx_Oracle.</tt><tt class="descname">connect</tt><big>(</big><span class="optional">[</span><em>user</em>, <em>password</em>, <em>dsn</em>, <em>mode</em>, <em>handle</em>, <em>pool</em>, <em>threaded</em>, <em>twophase</em>, <em>events</em>, <em>cclass</em>, <em>purity</em>, <em>newpassword</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#cx_Oracle.connect" title="Permalink to this definition"></a></dt>
<dd><p>Constructor for creating a connection to the database. Return a Connection
object (<a class="reference external" href="connection.html#connobj"><em>Connection Object</em></a>). All arguments are optional and can be specified as
keyword parameters.</p>
<p>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 <tt class="docutils literal"><span class="pre">user/password&#64;dsn</span></tt>, the same format accepted by Oracle
applications such as SQL*Plus.</p>
<p>If the mode is specified, it must be one of <a title="cx_Oracle.SYSDBA" class="reference internal" href="#cx_Oracle.SYSDBA"><tt class="xref docutils literal"><span class="pre">SYSDBA</span></tt></a> or
<a title="cx_Oracle.SYSOPER" class="reference internal" href="#cx_Oracle.SYSOPER"><tt class="xref docutils literal"><span class="pre">SYSOPER</span></tt></a> which are defined at the module level; otherwise it defaults
to the normal mode of connecting.</p>
<p>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.</p>
<p>The pool argument is expected to be a session pool object (<a class="reference external" href="session_pool.html#sesspool"><em>SessionPool Object</em></a>)
and the use of this argument is the equivalent of calling pool.acquire().</p>
<p>The threaded argument 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.</p>
<p>The twophase argument 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.</p>
<p>The events argument is expected to be a boolean expression which indicates
whether or not to initialize Oracle in events mode (only available in Oracle
11g and higher).</p>
<p>The cclass argument is expected to be a string and defines the connection
class for database resident connection pooling (DRCP) in Oracle 11g and
higher.</p>
<p>The purity argument is expected to be one of <a title="cx_Oracle.ATTR_PURITY_NEW" class="reference internal" href="#cx_Oracle.ATTR_PURITY_NEW"><tt class="xref docutils literal"><span class="pre">ATTR_PURITY_NEW</span></tt></a> (the
session must be new without any prior session state),
<a title="cx_Oracle.ATTR_PURITY_NEW" class="reference internal" href="#cx_Oracle.ATTR_PURITY_NEW"><tt class="xref docutils literal"><span class="pre">ATTR_PURITY_NEW</span></tt></a> (the session may have been used before) or
<a title="cx_Oracle.ATTR_PURITY_DEFAULT" class="reference internal" href="#cx_Oracle.ATTR_PURITY_DEFAULT"><tt class="xref docutils literal"><span class="pre">ATTR_PURITY_DEFAULT</span></tt></a> (the default behavior which is defined by Oracle
in its documentation). This argument is only relevant in Oracle 11g and
higher.</p>
<p>The newpassword argument is expected to be a string if specified and sets
the password for the logon during the connection process.</p>
</dd></dl>
<dl class="function">
<dt id="cx_Oracle.Cursor">
<!--[cx_Oracle.Cursor]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">Cursor</tt><big>(</big><em>connection</em><big>)</big><a class="headerlink" href="#cx_Oracle.Cursor" title="Permalink to this definition"></a></dt>
<dd><p>Constructor for creating a cursor. Return a new Cursor object
(<a class="reference external" href="cursor.html#cursorobj"><em>Cursor Object</em></a>) using the connection.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This method is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="function">
<dt id="cx_Oracle.Date">
<!--[cx_Oracle.Date]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">Date</tt><big>(</big><em>year</em>, <em>month</em>, <em>day</em><big>)</big><a class="headerlink" href="#cx_Oracle.Date" title="Permalink to this definition"></a></dt>
<dd>Construct an object holding a date value.</dd></dl>
<dl class="function">
<dt id="cx_Oracle.DateFromTicks">
<!--[cx_Oracle.DateFromTicks]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">DateFromTicks</tt><big>(</big><em>ticks</em><big>)</big><a class="headerlink" href="#cx_Oracle.DateFromTicks" title="Permalink to this definition"></a></dt>
<dd>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).</dd></dl>
<dl class="function">
<dt id="cx_Oracle.makedsn">
<!--[cx_Oracle.makedsn]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">makedsn</tt><big>(</big><em>host</em>, <em>port</em>, <em>sid</em><big>)</big><a class="headerlink" href="#cx_Oracle.makedsn" title="Permalink to this definition"></a></dt>
<dd><p>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.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This method is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="function">
<dt id="cx_Oracle.SessionPool">
<!--[cx_Oracle.SessionPool]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">SessionPool</tt><big>(</big><em>user</em>, <em>password</em>, <em>database</em>, <em>min</em>, <em>max</em>, <em>increment</em><span class="optional">[</span>, <em>connectiontype</em>, <em>threaded</em>, <em>getmode=cx_Oracle.SPOOL_ATTRVAL_NOWAIT</em>, <em>homogeneous=True</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#cx_Oracle.SessionPool" title="Permalink to this definition"></a></dt>
<dd><p>Create a session pool (see Oracle 9i documentation for more information) and
return a session pool object (<a class="reference external" href="session_pool.html#sesspool"><em>SessionPool Object</em></a>). 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.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This method is an extension to the DB API definition and is only
available in Oracle 9i.</p>
</div>
</dd></dl>
<dl class="function">
<dt id="cx_Oracle.Time">
<!--[cx_Oracle.Time]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">Time</tt><big>(</big><em>hour</em>, <em>minute</em>, <em>second</em><big>)</big><a class="headerlink" href="#cx_Oracle.Time" title="Permalink to this definition"></a></dt>
<dd>Construct an object holding a time value.</dd></dl>
<dl class="function">
<dt id="cx_Oracle.TimeFromTicks">
<!--[cx_Oracle.TimeFromTicks]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">TimeFromTicks</tt><big>(</big><em>ticks</em><big>)</big><a class="headerlink" href="#cx_Oracle.TimeFromTicks" title="Permalink to this definition"></a></dt>
<dd>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).</dd></dl>
<dl class="function">
<dt id="cx_Oracle.Timestamp">
<!--[cx_Oracle.Timestamp]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">Timestamp</tt><big>(</big><em>year</em>, <em>month</em>, <em>day</em>, <em>hour</em>, <em>minute</em>, <em>second</em><big>)</big><a class="headerlink" href="#cx_Oracle.Timestamp" title="Permalink to this definition"></a></dt>
<dd>Construct an object holding a time stamp value.</dd></dl>
<dl class="function">
<dt id="cx_Oracle.TimestampFromTicks">
<!--[cx_Oracle.TimestampFromTicks]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">TimestampFromTicks</tt><big>(</big><em>ticks</em><big>)</big><a class="headerlink" href="#cx_Oracle.TimestampFromTicks" title="Permalink to this definition"></a></dt>
<dd>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).</dd></dl>
<div class="section" id="id1">
<span id="constants"></span><h2>Constants<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h2>
<dl class="data">
<dt id="cx_Oracle.apilevel">
<!--[cx_Oracle.apilevel]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">apilevel</tt><a class="headerlink" href="#cx_Oracle.apilevel" title="Permalink to this definition"></a></dt>
<dd>String constant stating the supported DB API level. Currently &#8216;2.0&#8217;.</dd></dl>
<dl class="data">
<dt id="cx_Oracle.ATTR_PURITY_DEFAULT">
<!--[cx_Oracle.ATTR_PURITY_DEFAULT]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">ATTR_PURITY_DEFAULT</tt><a class="headerlink" href="#cx_Oracle.ATTR_PURITY_DEFAULT" title="Permalink to this definition"></a></dt>
<dd><p>This constant is used when using database resident connection pooling (DRCP)
and specifies that the purity of the session is the default value used by
Oracle (see Oracle&#8217;s documentation for more information).</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.ATTR_PURITY_NEW">
<!--[cx_Oracle.ATTR_PURITY_NEW]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">ATTR_PURITY_NEW</tt><a class="headerlink" href="#cx_Oracle.ATTR_PURITY_NEW" title="Permalink to this definition"></a></dt>
<dd><p>This constant is used when using database resident connection pooling (DRCP)
and specifies that the session acquired from the pool should be new and not
have any prior session state.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.ATTR_PURITY_SELF">
<!--[cx_Oracle.ATTR_PURITY_SELF]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">ATTR_PURITY_SELF</tt><a class="headerlink" href="#cx_Oracle.ATTR_PURITY_SELF" title="Permalink to this definition"></a></dt>
<dd><p>This constant is used when using database resident connection pooling (DRCP)
and specifies that the session acquired from the pool need not be new and
may have prior session state.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.buildtime">
<!--[cx_Oracle.buildtime]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">buildtime</tt><a class="headerlink" href="#cx_Oracle.buildtime" title="Permalink to this definition"></a></dt>
<dd><p>String constant stating the time when the binary was built.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.BINARY">
<!--[cx_Oracle.BINARY]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">BINARY</tt><a class="headerlink" href="#cx_Oracle.BINARY" title="Permalink to this definition"></a></dt>
<dd>This type object is used to describe columns in a database that are binary
(in Oracle this is RAW columns).</dd></dl>
<dl class="data">
<dt id="cx_Oracle.BFILE">
<!--[cx_Oracle.BFILE]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">BFILE</tt><a class="headerlink" href="#cx_Oracle.BFILE" title="Permalink to this definition"></a></dt>
<dd><p>This type object is used to describe columns in a database that are BFILEs.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.BLOB">
<!--[cx_Oracle.BLOB]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">BLOB</tt><a class="headerlink" href="#cx_Oracle.BLOB" title="Permalink to this definition"></a></dt>
<dd><p>This type object is used to describe columns in a database that are BLOBs.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.CLOB">
<!--[cx_Oracle.CLOB]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">CLOB</tt><a class="headerlink" href="#cx_Oracle.CLOB" title="Permalink to this definition"></a></dt>
<dd><p>This type object is used to describe columns in a database that are CLOBs.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.CURSOR">
<!--[cx_Oracle.CURSOR]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">CURSOR</tt><a class="headerlink" href="#cx_Oracle.CURSOR" title="Permalink to this definition"></a></dt>
<dd><p>This type object is used to describe columns in a database that are cursors
(in PL/SQL these are known as ref cursors).</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.DATETIME">
<!--[cx_Oracle.DATETIME]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">DATETIME</tt><a class="headerlink" href="#cx_Oracle.DATETIME" title="Permalink to this definition"></a></dt>
<dd>This type object is used to describe columns in a database that are dates.</dd></dl>
<dl class="data">
<dt id="cx_Oracle.DBSHUTDOWN_ABORT">
<!--[cx_Oracle.DBSHUTDOWN_ABORT]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">DBSHUTDOWN_ABORT</tt><a class="headerlink" href="#cx_Oracle.DBSHUTDOWN_ABORT" title="Permalink to this definition"></a></dt>
<dd><p>This constant is used in database shutdown to indicate that the program
should not wait for current calls to complete or for users to disconnect
from the database. Use only in unusual circumstances since database recovery
may be necessary upon next startup.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.DBSHUTDOWN_FINAL">
<!--[cx_Oracle.DBSHUTDOWN_FINAL]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">DBSHUTDOWN_FINAL</tt><a class="headerlink" href="#cx_Oracle.DBSHUTDOWN_FINAL" title="Permalink to this definition"></a></dt>
<dd><p>This constant is used in database shutdown to indicate that the instance can
be truly halted. This should only be done after the database has been shut
down in one of the other modes (except abort) and the database has been
closed and dismounted using the appropriate SQL commands. See the method
<a title="Connection.shutdown" class="reference external" href="connection.html#Connection.shutdown"><tt class="xref docutils literal"><span class="pre">shutdown()</span></tt></a> in the section on connections
(<a class="reference external" href="connection.html#connobj"><em>Connection Object</em></a>).</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.DBSHUTDOWN_IMMEDIATE">
<!--[cx_Oracle.DBSHUTDOWN_IMMEDIATE]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">DBSHUTDOWN_IMMEDIATE</tt><a class="headerlink" href="#cx_Oracle.DBSHUTDOWN_IMMEDIATE" title="Permalink to this definition"></a></dt>
<dd><p>This constant is used in database shutdown to indicate that all uncommitted
transactions should be rolled back and any connected users should be
disconnected.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.DBSHUTDOWN_TRANSACTIONAL">
<!--[cx_Oracle.DBSHUTDOWN_TRANSACTIONAL]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">DBSHUTDOWN_TRANSACTIONAL</tt><a class="headerlink" href="#cx_Oracle.DBSHUTDOWN_TRANSACTIONAL" title="Permalink to this definition"></a></dt>
<dd><p>This constant is used in database shutdown to indicate that further
connections should be prohibited and no new transactions should be allowed.
It then waits for active transactions to complete.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.DBSHUTDOWN_TRANSACTIONAL_LOCAL">
<!--[cx_Oracle.DBSHUTDOWN_TRANSACTIONAL_LOCAL]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">DBSHUTDOWN_TRANSACTIONAL_LOCAL</tt><a class="headerlink" href="#cx_Oracle.DBSHUTDOWN_TRANSACTIONAL_LOCAL" title="Permalink to this definition"></a></dt>
<dd><p>This constant is used in database shutdown to indicate that further
connections should be prohibited and no new transactions should be allowed.
It then waits for only local active transactions to complete.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.FIXED_CHAR">
<!--[cx_Oracle.FIXED_CHAR]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">FIXED_CHAR</tt><a class="headerlink" href="#cx_Oracle.FIXED_CHAR" title="Permalink to this definition"></a></dt>
<dd><p>This type object is used to describe columns in a database that are fixed
length strings (in Oracle this is CHAR columns); these behave differently in
Oracle than varchar2 so they are differentiated here even though the DB API
does not differentiate them.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.FNCODE_BINDBYNAME">
<!--[cx_Oracle.FNCODE_BINDBYNAME]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">FNCODE_BINDBYNAME</tt><a class="headerlink" href="#cx_Oracle.FNCODE_BINDBYNAME" title="Permalink to this definition"></a></dt>
<dd><p>This constant is used to register callbacks on the OCIBindByName() function
of the OCI.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.FNCODE_BINDBYPOS">
<!--[cx_Oracle.FNCODE_BINDBYPOS]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">FNCODE_BINDBYPOS</tt><a class="headerlink" href="#cx_Oracle.FNCODE_BINDBYPOS" title="Permalink to this definition"></a></dt>
<dd><p>This constant is used to register callbacks on the OCIBindByPos() function
of the OCI.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.FNCODE_DEFINEBYPOS">
<!--[cx_Oracle.FNCODE_DEFINEBYPOS]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">FNCODE_DEFINEBYPOS</tt><a class="headerlink" href="#cx_Oracle.FNCODE_DEFINEBYPOS" title="Permalink to this definition"></a></dt>
<dd><p>This constant is used to register callbacks on the OCIDefineByPos() function
of the OCI.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.FNCODE_STMTEXECUTE">
<!--[cx_Oracle.FNCODE_STMTEXECUTE]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">FNCODE_STMTEXECUTE</tt><a class="headerlink" href="#cx_Oracle.FNCODE_STMTEXECUTE" title="Permalink to this definition"></a></dt>
<dd><p>This constant is used to register callbacks on the OCIStmtExecute() function
of the OCI.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.FNCODE_STMTFETCH">
<!--[cx_Oracle.FNCODE_STMTFETCH]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">FNCODE_STMTFETCH</tt><a class="headerlink" href="#cx_Oracle.FNCODE_STMTFETCH" title="Permalink to this definition"></a></dt>
<dd><p>This constant is used to register callbacks on the OCIStmtFetch() function
of the OCI.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.FNCODE_STMTPREPARE">
<!--[cx_Oracle.FNCODE_STMTPREPARE]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">FNCODE_STMTPREPARE</tt><a class="headerlink" href="#cx_Oracle.FNCODE_STMTPREPARE" title="Permalink to this definition"></a></dt>
<dd><p>This constant is used to register callbacks on the OCIStmtPrepare() function
of the OCI.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.INTERVAL">
<!--[cx_Oracle.INTERVAL]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">INTERVAL</tt><a class="headerlink" href="#cx_Oracle.INTERVAL" title="Permalink to this definition"></a></dt>
<dd><p>This type object is used to describe columns in a database that are of type
interval day to second.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.LOB">
<!--[cx_Oracle.LOB]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">LOB</tt><a class="headerlink" href="#cx_Oracle.LOB" title="Permalink to this definition"></a></dt>
<dd><p>This type object is the Python type of <a title="cx_Oracle.BLOB" class="reference internal" href="#cx_Oracle.BLOB"><tt class="xref docutils literal"><span class="pre">BLOB</span></tt></a> and <a title="cx_Oracle.CLOB" class="reference internal" href="#cx_Oracle.CLOB"><tt class="xref docutils literal"><span class="pre">CLOB</span></tt></a> data
that is returned from cursors.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.LONG_BINARY">
<!--[cx_Oracle.LONG_BINARY]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">LONG_BINARY</tt><a class="headerlink" href="#cx_Oracle.LONG_BINARY" title="Permalink to this definition"></a></dt>
<dd><p>This type object is used to describe columns in a database that are long
binary (in Oracle these are LONG RAW columns).</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.LONG_STRING">
<!--[cx_Oracle.LONG_STRING]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">LONG_STRING</tt><a class="headerlink" href="#cx_Oracle.LONG_STRING" title="Permalink to this definition"></a></dt>
<dd><p>This type object is used to describe columns in a database that are long
strings (in Oracle these are LONG columns).</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.NATIVE_FLOAT">
<!--[cx_Oracle.NATIVE_FLOAT]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">NATIVE_FLOAT</tt><a class="headerlink" href="#cx_Oracle.NATIVE_FLOAT" title="Permalink to this definition"></a></dt>
<dd><p>This type object is used to describe columns in a database that are of type
binary_double or binary_float and is only available in Oracle 10g.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.NCLOB">
<!--[cx_Oracle.NCLOB]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">NCLOB</tt><a class="headerlink" href="#cx_Oracle.NCLOB" title="Permalink to this definition"></a></dt>
<dd><p>This type object is used to describe columns in a database that are NCLOBs.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.NUMBER">
<!--[cx_Oracle.NUMBER]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">NUMBER</tt><a class="headerlink" href="#cx_Oracle.NUMBER" title="Permalink to this definition"></a></dt>
<dd>This type object is used to describe columns in a database that are numbers.</dd></dl>
<dl class="data">
<dt id="cx_Oracle.OBJECT">
<!--[cx_Oracle.OBJECT]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">OBJECT</tt><a class="headerlink" href="#cx_Oracle.OBJECT" title="Permalink to this definition"></a></dt>
<dd><p>This type object is used to describe columns in a database that are objects.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.paramstyle">
<!--[cx_Oracle.paramstyle]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">paramstyle</tt><a class="headerlink" href="#cx_Oracle.paramstyle" title="Permalink to this definition"></a></dt>
<dd>String constant stating the type of parameter marker formatting expected by
the interface. Currently &#8216;named&#8217; as in &#8216;where name = :name&#8217;.</dd></dl>
<dl class="data">
<dt id="cx_Oracle.ROWID">
<!--[cx_Oracle.ROWID]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">ROWID</tt><a class="headerlink" href="#cx_Oracle.ROWID" title="Permalink to this definition"></a></dt>
<dd>This type object is used to describe the pseudo column &#8220;rowid&#8221;.</dd></dl>
<dl class="data">
<dt id="cx_Oracle.PRELIM_AUTH">
<!--[cx_Oracle.PRELIM_AUTH]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">PRELIM_AUTH</tt><a class="headerlink" href="#cx_Oracle.PRELIM_AUTH" title="Permalink to this definition"></a></dt>
<dd><p>This constant is used to define the preliminary authentication mode required
for performing database startup and shutdown.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.SPOOL_ATTRVAL_FORCEGET">
<!--[cx_Oracle.SPOOL_ATTRVAL_FORCEGET]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">SPOOL_ATTRVAL_FORCEGET</tt><a class="headerlink" href="#cx_Oracle.SPOOL_ATTRVAL_FORCEGET" title="Permalink to this definition"></a></dt>
<dd><p>This constant is used to define the &#8220;get&#8221; mode on session pools and
indicates that a new connection will be returned if there are no free
sessions available in the pool.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.SPOOL_ATTRVAL_NOWAIT">
<!--[cx_Oracle.SPOOL_ATTRVAL_NOWAIT]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">SPOOL_ATTRVAL_NOWAIT</tt><a class="headerlink" href="#cx_Oracle.SPOOL_ATTRVAL_NOWAIT" title="Permalink to this definition"></a></dt>
<dd><p>This constant is used to define the &#8220;get&#8221; mode on session pools and
indicates that an exception is raised if there are no free sessions
available in the pool.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.SPOOL_ATTRVAL_WAIT">
<!--[cx_Oracle.SPOOL_ATTRVAL_WAIT]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">SPOOL_ATTRVAL_WAIT</tt><a class="headerlink" href="#cx_Oracle.SPOOL_ATTRVAL_WAIT" title="Permalink to this definition"></a></dt>
<dd><p>This constant is used to define the &#8220;get&#8221; mode on session pools and
indicates that the acquisition of a connection waits until a session is
freed if there are no free sessions available in the pool.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.STRING">
<!--[cx_Oracle.STRING]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">STRING</tt><a class="headerlink" href="#cx_Oracle.STRING" title="Permalink to this definition"></a></dt>
<dd>This type object is used to describe columns in a database that are strings
(in Oracle this is VARCHAR2 columns).</dd></dl>
<dl class="data">
<dt id="cx_Oracle.SYSDBA">
<!--[cx_Oracle.SYSDBA]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">SYSDBA</tt><a class="headerlink" href="#cx_Oracle.SYSDBA" title="Permalink to this definition"></a></dt>
<dd><p>Value to be passed to the connect() method which indicates that SYSDBA
access is to be acquired. See the Oracle documentation for more details.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.SYSOPER">
<!--[cx_Oracle.SYSOPER]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">SYSOPER</tt><a class="headerlink" href="#cx_Oracle.SYSOPER" title="Permalink to this definition"></a></dt>
<dd><p>Value to be passed to the connect() method which indicates that SYSOPER
access is to be acquired. See the Oracle documentation for more details.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.threadsafety">
<!--[cx_Oracle.threadsafety]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">threadsafety</tt><a class="headerlink" href="#cx_Oracle.threadsafety" title="Permalink to this definition"></a></dt>
<dd><p>Integer constant stating the level of thread safety that the interface
supports. Currently 2, which means that threads may share the module and
connections, but not cursors. Sharing means that a thread may use a
resource without wrapping it using a mutex semaphore to implement resource
locking.</p>
<p>Note that in order to make use of multiple threads in a program which
intends to connect and disconnect in different threads, the threaded
argument to the Connection constructor must be a true value. See the
comments on the Connection constructor for more information (<a class="reference internal" href="#module"><em>Module Interface</em></a>).</p>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.TIMESTAMP">
<!--[cx_Oracle.TIMESTAMP]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">TIMESTAMP</tt><a class="headerlink" href="#cx_Oracle.TIMESTAMP" title="Permalink to this definition"></a></dt>
<dd><p>This type object is used to describe columns in a database that are
timestamps.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition and is only
available in Oracle 9i.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.UCBTYPE_ENTRY">
<!--[cx_Oracle.UCBTYPE_ENTRY]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">UCBTYPE_ENTRY</tt><a class="headerlink" href="#cx_Oracle.UCBTYPE_ENTRY" title="Permalink to this definition"></a></dt>
<dd><p>This constant is used to register callbacks on entry to the function of the
OCI. In other words, the callback will be called prior to the execution of
the OCI function.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.UCBTYPE_EXIT">
<!--[cx_Oracle.UCBTYPE_EXIT]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">UCBTYPE_EXIT</tt><a class="headerlink" href="#cx_Oracle.UCBTYPE_EXIT" title="Permalink to this definition"></a></dt>
<dd><p>This constant is used to register callbacks on exit from the function of the
OCI. In other words, the callback will be called after the execution of the
OCI function.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.UCBTYPE_REPLACE">
<!--[cx_Oracle.UCBTYPE_REPLACE]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">UCBTYPE_REPLACE</tt><a class="headerlink" href="#cx_Oracle.UCBTYPE_REPLACE" title="Permalink to this definition"></a></dt>
<dd><p>This constant is used to register callbacks that completely replace the call
to the OCI function.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
<dl class="data">
<dt id="cx_Oracle.version">
<!--[cx_Oracle.version]--><tt class="descclassname">cx_Oracle.</tt><tt class="descname">version</tt><a class="headerlink" href="#cx_Oracle.version" title="Permalink to this definition"></a></dt>
<dd><p>String constant stating the version of the module. Currently &#8216;5.0&#8216;.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This attribute is an extension to the DB API definition.</p>
</div>
</dd></dl>
</div>
<div class="section" id="id2">
<span id="exceptions"></span><h2>Exceptions<a class="headerlink" href="#id2" title="Permalink to this headline"></a></h2>
<dl class="exception">
<dt id="cx_Oracle.Warning">
<!--[cx_Oracle.Warning]-->exception <tt class="descclassname">cx_Oracle.</tt><tt class="descname">Warning</tt><a class="headerlink" href="#cx_Oracle.Warning" title="Permalink to this definition"></a></dt>
<dd>Exception raised for important warnings and defined by the DB API but not
actually used by cx_Oracle.</dd></dl>
<dl class="exception">
<dt id="cx_Oracle.Error">
<!--[cx_Oracle.Error]-->exception <tt class="descclassname">cx_Oracle.</tt><tt class="descname">Error</tt><a class="headerlink" href="#cx_Oracle.Error" title="Permalink to this definition"></a></dt>
<dd>Exception that is the base class of all other exceptions defined by
cx_Oracle and is a subclass of the Python StandardError exception (defined
in the module exceptions).</dd></dl>
<dl class="exception">
<dt id="cx_Oracle.InterfaceError">
<!--[cx_Oracle.InterfaceError]-->exception <tt class="descclassname">cx_Oracle.</tt><tt class="descname">InterfaceError</tt><a class="headerlink" href="#cx_Oracle.InterfaceError" title="Permalink to this definition"></a></dt>
<dd>Exception raised for errors that are related to the database interface
rather than the database itself. It is a subclass of Error.</dd></dl>
<dl class="exception">
<dt id="cx_Oracle.DatabaseError">
<!--[cx_Oracle.DatabaseError]-->exception <tt class="descclassname">cx_Oracle.</tt><tt class="descname">DatabaseError</tt><a class="headerlink" href="#cx_Oracle.DatabaseError" title="Permalink to this definition"></a></dt>
<dd>Exception raised for errors that are related to the database. It is a
subclass of Error.</dd></dl>
<dl class="exception">
<dt id="cx_Oracle.DataError">
<!--[cx_Oracle.DataError]-->exception <tt class="descclassname">cx_Oracle.</tt><tt class="descname">DataError</tt><a class="headerlink" href="#cx_Oracle.DataError" title="Permalink to this definition"></a></dt>
<dd>Exception raised for errors that are due to problems with the processed
data. It is a subclass of DatabaseError.</dd></dl>
<dl class="exception">
<dt id="cx_Oracle.OperationalError">
<!--[cx_Oracle.OperationalError]-->exception <tt class="descclassname">cx_Oracle.</tt><tt class="descname">OperationalError</tt><a class="headerlink" href="#cx_Oracle.OperationalError" title="Permalink to this definition"></a></dt>
<dd>Exception raised for errors that are related to the operation of the
database but are not necessarily under the control of the progammer. It is a
subclass of DatabaseError.</dd></dl>
<dl class="exception">
<dt id="cx_Oracle.IntegrityError">
<!--[cx_Oracle.IntegrityError]-->exception <tt class="descclassname">cx_Oracle.</tt><tt class="descname">IntegrityError</tt><a class="headerlink" href="#cx_Oracle.IntegrityError" title="Permalink to this definition"></a></dt>
<dd>Exception raised when the relational integrity of the database is affected.
It is a subclass of DatabaseError.</dd></dl>
<dl class="exception">
<dt id="cx_Oracle.InternalError">
<!--[cx_Oracle.InternalError]-->exception <tt class="descclassname">cx_Oracle.</tt><tt class="descname">InternalError</tt><a class="headerlink" href="#cx_Oracle.InternalError" title="Permalink to this definition"></a></dt>
<dd>Exception raised when the database encounters an internal error. It is a
subclass of DatabaseError.</dd></dl>
<dl class="exception">
<dt id="cx_Oracle.ProgrammingError">
<!--[cx_Oracle.ProgrammingError]-->exception <tt class="descclassname">cx_Oracle.</tt><tt class="descname">ProgrammingError</tt><a class="headerlink" href="#cx_Oracle.ProgrammingError" title="Permalink to this definition"></a></dt>
<dd>Exception raised for programming errors. It is a subclass of DatabaseError.</dd></dl>
<dl class="exception">
<dt id="cx_Oracle.NotSupportedError">
<!--[cx_Oracle.NotSupportedError]-->exception <tt class="descclassname">cx_Oracle.</tt><tt class="descname">NotSupportedError</tt><a class="headerlink" href="#cx_Oracle.NotSupportedError" title="Permalink to this definition"></a></dt>
<dd>Exception raised when a method or database API was used which is not
supported by the database. It is a subclass of DatabaseError.</dd></dl>
</div>
<div class="section" id="exception-handling">
<h2>Exception handling<a class="headerlink" href="#exception-handling" title="Permalink to this headline"></a></h2>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>PEP 249 (Python Database API Specification v2.0) says the following about
exception values:</p>
<blockquote>
[...] The values of these exceptions are not defined. They should
give the user a fairly good idea of what went wrong, though. [...]</blockquote>
<p class="last">With cx_Oracle every exception object has exactly one argument in the
<tt class="docutils literal"><span class="pre">args</span></tt> tuple. This argument is a <tt class="docutils literal"><span class="pre">cx_Oracle._Error</span></tt> object which has
the following three read-only attributes.</p>
</div>
<dl class="attribute">
<dt id="cx_Oracle._Error.code">
<!--[cx_Oracle._Error.code]--><tt class="descclassname">_Error.</tt><tt class="descname">code</tt><a class="headerlink" href="#cx_Oracle._Error.code" title="Permalink to this definition"></a></dt>
<dd>Integer attribute representing the Oracle error number (ORA-XXXXX).</dd></dl>
<dl class="attribute">
<dt id="cx_Oracle._Error.message">
<!--[cx_Oracle._Error.message]--><tt class="descclassname">_Error.</tt><tt class="descname">message</tt><a class="headerlink" href="#cx_Oracle._Error.message" title="Permalink to this definition"></a></dt>
<dd>String attribute representing the Oracle message of the error. This
message is localized by the environment of the Oracle connection.</dd></dl>
<dl class="attribute">
<dt id="cx_Oracle._Error.context">
<!--[cx_Oracle._Error.context]--><tt class="descclassname">_Error.</tt><tt class="descname">context</tt><a class="headerlink" href="#cx_Oracle._Error.context" title="Permalink to this definition"></a></dt>
<dd>String attribute representing the context in which the exception was
raised..</dd></dl>
<p>This allows you to use the exceptions for example in the following way:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">sys</span>
<span class="kn">import</span> <span class="nn">cx_Oracle</span>
<span class="n">connection</span> <span class="o">=</span> <span class="n">cx_Oracle</span><span class="o">.</span><span class="n">Connection</span><span class="p">(</span><span class="s">&quot;user/pw@tns&quot;</span><span class="p">)</span>
<span class="n">cursor</span> <span class="o">=</span> <span class="n">connection</span><span class="o">.</span><span class="n">cursor</span><span class="p">()</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s">&quot;select 1 / 0 from dual&quot;</span><span class="p">)</span>
<span class="k">except</span> <span class="n">cx_Oracle</span><span class="o">.</span><span class="n">DatabaseError</span><span class="p">,</span> <span class="n">exc</span><span class="p">:</span>
<span class="n">error</span><span class="p">,</span> <span class="o">=</span> <span class="n">exc</span><span class="o">.</span><span class="n">args</span>
<span class="k">print</span> <span class="o">&gt;&gt;</span> <span class="n">sys</span><span class="o">.</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Oracle-Error-Code:&quot;</span><span class="p">,</span> <span class="n">error</span><span class="o">.</span><span class="n">code</span>
<span class="k">print</span> <span class="o">&gt;&gt;</span> <span class="n">sys</span><span class="o">.</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Oracle-Error-Message:&quot;</span><span class="p">,</span> <span class="n">error</span><span class="o">.</span><span class="n">message</span>
</pre></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference external" href="">Module Interface</a><ul>
<li><a class="reference external" href="#id1">Constants</a></li>
<li><a class="reference external" href="#id2">Exceptions</a></li>
<li><a class="reference external" href="#exception-handling">Exception handling</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="index.html" title="previous chapter">cx_Oracle</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="connection.html" title="next chapter">Connection Object</a></p>
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" size="18" /> <input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="modindex.html" title="Global Module Index"
accesskey="M">modules</a> |</li>
<li class="right" >
<a href="connection.html" title="Connection Object"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="index.html" title="cx_Oracle"
accesskey="P">previous</a> |</li>
<li><a href="index.html">cx_Oracle v5.0 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2008, Anthony Tuininga.
Last updated on Jan 06, 2009.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.1.
</div>
</body>
</html>