![]() |
OCILIB (C and C++ Driver for Oracle)
4.9.0
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
|
OcilibCApiErrorHandling
Connecting to an Oracle database server is done with a single call to OCI_ConnectionCreate().
OCI_ConnectionFree() closes the established connection and releases its resources.
Connection properties are accessible through a set of dedicated functions.
Functions | |
| OCI_SYM_PUBLIC OCI_Connection *OCI_API | OCI_ConnectionCreate (const otext *db, const otext *user, const otext *pwd, unsigned int mode) |
| Create a physical connection to an Oracle database server. | |
| OCI_SYM_PUBLIC boolean OCI_API | OCI_ConnectionFree (OCI_Connection *con) |
| Close a physical connection to an Oracle database server. | |
| OCI_SYM_PUBLIC boolean OCI_API | OCI_IsConnected (OCI_Connection *con) |
| Check if the given connection is still active. | |
| OCI_SYM_PUBLIC void *OCI_API | OCI_GetUserData (OCI_Connection *con) |
| Return the pointer to user data previously associated with the connection. | |
| OCI_SYM_PUBLIC boolean OCI_API | OCI_SetUserData (OCI_Connection *con, void *data) |
| Associate a pointer to user data with the given connection. | |
| OCI_SYM_PUBLIC boolean OCI_API | OCI_SetSessionTag (OCI_Connection *con, const otext *tag) |
| Associate a tag with the given connection/session. | |
| OCI_SYM_PUBLIC const otext *OCI_API | OCI_GetSessionTag (OCI_Connection *con) |
| Return the tag associated with the given connection. | |
| OCI_SYM_PUBLIC const otext *OCI_API | OCI_GetDatabase (OCI_Connection *con) |
| Return the name of the connected database or service name. | |
| OCI_SYM_PUBLIC const otext *OCI_API | OCI_GetUserName (OCI_Connection *con) |
| Return the user name of the currently logged-in session. | |
| OCI_SYM_PUBLIC const otext *OCI_API | OCI_GetPassword (OCI_Connection *con) |
| Return the password of the currently logged-in session. | |
| OCI_SYM_PUBLIC boolean OCI_API | OCI_SetPassword (OCI_Connection *con, const otext *password) |
| Change the password of the currently logged-in user. | |
| OCI_SYM_PUBLIC boolean OCI_API | OCI_SetUserPassword (const otext *db, const otext *user, const otext *pwd, const otext *new_pwd) |
| Change the password of the given user on the specified database. | |
| OCI_SYM_PUBLIC unsigned int OCI_API | OCI_GetSessionMode (OCI_Connection *con) |
| Return the current session mode. | |
| OCI_SYM_PUBLIC const otext *OCI_API | OCI_GetVersionServer (OCI_Connection *con) |
| Return the connected database server version string (server banner), as reported by SQL*Plus. | |
| OCI_SYM_PUBLIC unsigned int OCI_API | OCI_GetServerMajorVersion (OCI_Connection *con) |
| Return the major version number of the connected database server. | |
| OCI_SYM_PUBLIC unsigned int OCI_API | OCI_GetServerMinorVersion (OCI_Connection *con) |
| Return the minor version number of the connected database server. | |
| OCI_SYM_PUBLIC unsigned int OCI_API | OCI_GetServerRevisionVersion (OCI_Connection *con) |
| Return the revision version number of the connected database server. | |
| OCI_SYM_PUBLIC boolean OCI_API | OCI_SetFormat (OCI_Connection *con, unsigned int type, const otext *format) |
| Set the format string for implicit string conversions of the given type. | |
| OCI_SYM_PUBLIC const otext *OCI_API | OCI_GetFormat (OCI_Connection *con, unsigned int type) |
| Return the format string for implicit string conversions of the given type. | |
| OCI_SYM_PUBLIC OCI_Transaction *OCI_API | OCI_GetTransaction (OCI_Connection *con) |
| Return the current transaction associated with the connection. | |
| OCI_SYM_PUBLIC boolean OCI_API | OCI_SetTransaction (OCI_Connection *con, OCI_Transaction *trans) |
| Associate a transaction with a connection. | |
| OCI_SYM_PUBLIC unsigned int OCI_API | OCI_GetVersionConnection (OCI_Connection *con) |
| Return the highest Oracle version supported by the connection. | |
| OCI_SYM_PUBLIC boolean OCI_API | OCI_SetTrace (OCI_Connection *con, unsigned int trace, const otext *value) |
| Set tracing information on the session of the given connection. | |
| OCI_SYM_PUBLIC const otext *OCI_API | OCI_GetTrace (OCI_Connection *con, unsigned int trace) |
| Return the current trace value for the given trace type from the connection. | |
| OCI_SYM_PUBLIC boolean OCI_API | OCI_Ping (OCI_Connection *con) |
| Perform a round-trip call to the server to verify that the connection and server are active. | |
| OCI_SYM_PUBLIC boolean OCI_API | OCI_SetTimeout (OCI_Connection *con, unsigned int type, unsigned int value) |
| Set a given timeout for OCI calls that require server round-trips to the given database. | |
| OCI_SYM_PUBLIC unsigned int OCI_API | OCI_GetTimeout (OCI_Connection *con, unsigned int type) |
| Return the requested timeout value for OCI calls that require server round-trips. | |
| OCI_SYM_PUBLIC const otext *OCI_API | OCI_GetDBName (OCI_Connection *con) |
| Return the Oracle server database name of the connected database. | |
| OCI_SYM_PUBLIC const otext *OCI_API | OCI_GetInstanceName (OCI_Connection *con) |
| Return the Oracle server instance name of the connected database. | |
| OCI_SYM_PUBLIC const otext *OCI_API | OCI_GetServiceName (OCI_Connection *con) |
| Return the Oracle server service name of the connected database. | |
| OCI_SYM_PUBLIC const otext *OCI_API | OCI_GetServerName (OCI_Connection *con) |
| Return the Oracle server machine name of the connected database. | |
| OCI_SYM_PUBLIC const otext *OCI_API | OCI_GetDomainName (OCI_Connection *con) |
| Return the Oracle server domain name of the connected database. | |
| OCI_SYM_PUBLIC OCI_Timestamp *OCI_API | OCI_GetInstanceStartTime (OCI_Connection *con) |
| Return the date and time (Timestamp) at which the server instance was started. | |
| OCI_SYM_PUBLIC boolean OCI_API | OCI_IsTAFCapable (OCI_Connection *con) |
| Check if the given connection supports Transparent Application Failover (TAF) events. | |
| OCI_SYM_PUBLIC boolean OCI_API | OCI_SetTAFHandler (OCI_Connection *con, POCI_TAF_HANDLER handler) |
| Set the Transparent Application Failover (TAF) user handler. | |
| OCI_SYM_PUBLIC unsigned int OCI_API | OCI_GetStatementCacheSize (OCI_Connection *con) |
| Return the maximum number of statements to keep in the statement cache. | |
| OCI_SYM_PUBLIC boolean OCI_API | OCI_SetStatementCacheSize (OCI_Connection *con, unsigned int value) |
| Set the maximum number of statements to keep in the statement cache. | |
| OCI_SYM_PUBLIC unsigned int OCI_API | OCI_GetDefaultLobPrefetchSize (OCI_Connection *con) |
| Return the default LOB prefetch buffer size for the connection. | |
| OCI_SYM_PUBLIC boolean OCI_API | OCI_SetDefaultLobPrefetchSize (OCI_Connection *con, unsigned int value) |
| Enable or disable prefetching for all LOBs fetched in the connection. | |
| OCI_SYM_PUBLIC unsigned int OCI_API | OCI_GetMaxCursors (OCI_Connection *con) |
| Return the maximum number of SQL statements that can be opened in one session. | |
| OCI_SYM_PUBLIC OCI_Connection *OCI_API OCI_ConnectionCreate | ( | const otext * | db, |
| const otext * | user, | ||
| const otext * | pwd, | ||
| unsigned int | mode | ||
| ) |
#include <api.h>
Create a physical connection to an Oracle database server.
| db | - Oracle Service Name (or NULL for the default local database) |
| user | - Oracle user name (or NULL for external credentials) |
| pwd | - Oracle user password (or NULL for external credentials) |
| mode | - Session mode |
Possible values for parameter mode (mutually exclusive, cannot be combined):
OCILIB supports Oracle XA connectivity. To obtain a connection through the XA interface:
The XA connection string used in a transaction monitor to connect to Oracle must be compatible with OCILIB:
Referenced by ocilib::Connection::Open().
| OCI_SYM_PUBLIC boolean OCI_API OCI_ConnectionFree | ( | OCI_Connection * | con | ) |
#include <api.h>
Close a physical connection to an Oracle database server.
| con | - Connection handle |
| OCI_SYM_PUBLIC boolean OCI_API OCI_IsConnected | ( | OCI_Connection * | con | ) |
#include <api.h>
Check if the given connection is still active.
| con | - Connection handle |
Referenced by ocilib::Connection::IsServerAlive().
| OCI_SYM_PUBLIC void *OCI_API OCI_GetUserData | ( | OCI_Connection * | con | ) |
#include <api.h>
Return the pointer to user data previously associated with the connection.
| con | - Connection handle |
con parameter is valid. In that case, the function returns the user data stored with global (program-wide) scope.Referenced by ocilib::Connection::GetUserData(), and ocilib::Environment::Initialize().
| OCI_SYM_PUBLIC boolean OCI_API OCI_SetUserData | ( | OCI_Connection * | con, |
| void * | data | ||
| ) |
#include <api.h>
Associate a pointer to user data with the given connection.
| con | - Connection handle |
| data | - User data pointer |
con parameter is valid. In that case, the user data is stored with global (program-wide) scope.Referenced by ocilib::Connection::SetUserData().
| OCI_SYM_PUBLIC boolean OCI_API OCI_SetSessionTag | ( | OCI_Connection * | con, |
| const otext * | tag | ||
| ) |
#include <api.h>
Associate a tag with the given connection/session.
| con | - Connection handle |
| tag | - User tag string |
Referenced by ocilib::Connection::SetSessionTag().
| OCI_SYM_PUBLIC const otext *OCI_API OCI_GetSessionTag | ( | OCI_Connection * | con | ) |
#include <api.h>
Return the tag associated with the given connection.
| con | - Connection handle |
Referenced by ocilib::Connection::GetSessionTag().
| OCI_SYM_PUBLIC const otext *OCI_API OCI_GetDatabase | ( | OCI_Connection * | con | ) |
#include <api.h>
Return the name of the connected database or service name.
| con | - Connection handle |
Referenced by ocilib::Connection::GetConnectionString().
| OCI_SYM_PUBLIC const otext *OCI_API OCI_GetUserName | ( | OCI_Connection * | con | ) |
#include <api.h>
Return the user name of the currently logged-in session.
| con | - Connection handle |
Referenced by ocilib::Connection::GetUserName().
| OCI_SYM_PUBLIC const otext *OCI_API OCI_GetPassword | ( | OCI_Connection * | con | ) |
#include <api.h>
Return the password of the currently logged-in session.
| con | - Connection handle |
Referenced by ocilib::Connection::GetPassword().
| OCI_SYM_PUBLIC boolean OCI_API OCI_SetPassword | ( | OCI_Connection * | con, |
| const otext * | password | ||
| ) |
#include <api.h>
Change the password of the currently logged-in user.
| con | - Connection handle |
| password | - New password |
Referenced by ocilib::Connection::ChangePassword().
| OCI_SYM_PUBLIC boolean OCI_API OCI_SetUserPassword | ( | const otext * | db, |
| const otext * | user, | ||
| const otext * | pwd, | ||
| const otext * | new_pwd | ||
| ) |
#include <api.h>
Change the password of the given user on the specified database.
| db | - Oracle Service Name |
| user | - Oracle user name |
| pwd | - Current Oracle user password |
| new_pwd | - New Oracle user password |
Referenced by ocilib::Environment::ChangeUserPassword().
| OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetSessionMode | ( | OCI_Connection * | con | ) |
#include <api.h>
Return the current session mode.
| con | - Connection handle |
| OCI_SYM_PUBLIC const otext *OCI_API OCI_GetVersionServer | ( | OCI_Connection * | con | ) |
#include <api.h>
Return the connected database server version string (server banner), as reported by SQL*Plus.
| con | - Connection handle |
Referenced by ocilib::Connection::GetServerVersion().
| OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetServerMajorVersion | ( | OCI_Connection * | con | ) |
#include <api.h>
Return the major version number of the connected database server.
| con | - Connection handle |
Referenced by ocilib::Connection::GetServerMajorVersion().
| OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetServerMinorVersion | ( | OCI_Connection * | con | ) |
#include <api.h>
Return the minor version number of the connected database server.
| con | - Connection handle |
Referenced by ocilib::Connection::GetServerMinorVersion().
| OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetServerRevisionVersion | ( | OCI_Connection * | con | ) |
#include <api.h>
Return the revision version number of the connected database server.
| con | - Connection handle |
Referenced by ocilib::Connection::GetServerRevisionVersion().
| OCI_SYM_PUBLIC boolean OCI_API OCI_SetFormat | ( | OCI_Connection * | con, |
| unsigned int | type, | ||
| const otext * | format | ||
| ) |
#include <api.h>
Set the format string for implicit string conversions of the given type.
| con | - Connection handle (or NULL for library-level format) |
| type | - Type of format |
| format | - Format string |
Formats can be set at two levels:
When a string conversion is needed, OCILIB searches for a valid format in the following order:
Referenced by ocilib::Environment::SetFormat(), and ocilib::Connection::SetFormat().
| OCI_SYM_PUBLIC const otext *OCI_API OCI_GetFormat | ( | OCI_Connection * | con, |
| unsigned int | type | ||
| ) |
#include <api.h>
Return the format string for implicit string conversions of the given type.
| con | - Connection handle (or NULL for library-level format) |
| type | - Type of format |
Referenced by ocilib::Environment::GetFormat(), and ocilib::Connection::GetFormat().
| OCI_SYM_PUBLIC OCI_Transaction *OCI_API OCI_GetTransaction | ( | OCI_Connection * | con | ) |
#include <api.h>
Return the current transaction associated with the connection.
| con | - Connection handle |
Referenced by ocilib::Connection::GetTransaction().
| OCI_SYM_PUBLIC boolean OCI_API OCI_SetTransaction | ( | OCI_Connection * | con, |
| OCI_Transaction * | trans | ||
| ) |
#include <api.h>
Associate a transaction with a connection.
| con | - Connection handle |
| trans | - Transaction handle to assign |
Referenced by ocilib::Connection::SetTransaction().
| OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetVersionConnection | ( | OCI_Connection * | con | ) |
#include <api.h>
Return the highest Oracle version supported by the connection.
| con | - Connection handle |
Referenced by ocilib::Connection::GetVersion().
| OCI_SYM_PUBLIC boolean OCI_API OCI_SetTrace | ( | OCI_Connection * | con, |
| unsigned int | trace, | ||
| const otext * | value | ||
| ) |
#include <api.h>
Set tracing information on the session of the given connection.
| con | - Connection handle |
| trace | - Trace type |
| value | - Trace content string |
Stores trace information on the given connection session. This information:
OCILIB truncates input values to match these limits.
Referenced by ocilib::Connection::SetTrace().
| OCI_SYM_PUBLIC const otext *OCI_API OCI_GetTrace | ( | OCI_Connection * | con, |
| unsigned int | trace | ||
| ) |
#include <api.h>
Return the current trace value for the given trace type from the connection.
| con | - Connection handle |
| trace | - Trace type |
Referenced by ocilib::Connection::GetTrace().
| OCI_SYM_PUBLIC boolean OCI_API OCI_Ping | ( | OCI_Connection * | con | ) |
#include <api.h>
Perform a round-trip call to the server to verify that the connection and server are active.
| con | - Connection handle |
Referenced by ocilib::Connection::PingServer().
| OCI_SYM_PUBLIC boolean OCI_API OCI_SetTimeout | ( | OCI_Connection * | con, |
| unsigned int | type, | ||
| unsigned int | value | ||
| ) |
#include <api.h>
Set a given timeout for OCI calls that require server round-trips to the given database.
| con | - Connection handle |
| type | - Type of timeout to set |
| value | - Timeout in milliseconds |
Possible values for parameter 'type':
The OCI client raises a timeout-related error when a given timeout is reached.
Summary:
| FLAG | Min. Version | OCI Error raised | OCI Error description | sqlnet.ora equivalent |
|---|---|---|---|---|
| OCI_NTO_SEND | OCI_12_1 | ORA-12608 | TNS: Send timeout occurred | SQLNET.SEND_TIMEOUT |
| OCI_NTO_RECEIVE | OCI_12_1 | ORA-12609 | TNS: Receive timeout occurred | SQLNET.RECV_TIMEOUT |
| OCI_NTO_CALL | OCI_18_1 | ORA-03136 | Inbound connection timed out | — |
Referenced by ocilib::Connection::SetTimeout().
| OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetTimeout | ( | OCI_Connection * | con, |
| unsigned int | type | ||
| ) |
#include <api.h>
Return the requested timeout value for OCI calls that require server round-trips.
| con | - Connection handle |
| type | - Type of timeout |
Referenced by ocilib::Connection::GetTimeout().
| OCI_SYM_PUBLIC const otext *OCI_API OCI_GetDBName | ( | OCI_Connection * | con | ) |
#include <api.h>
Return the Oracle server database name of the connected database.
| con | - Connection handle |
Referenced by ocilib::Connection::GetDatabase().
| OCI_SYM_PUBLIC const otext *OCI_API OCI_GetInstanceName | ( | OCI_Connection * | con | ) |
#include <api.h>
Return the Oracle server instance name of the connected database.
| con | - Connection handle |
Referenced by ocilib::Connection::GetInstance().
| OCI_SYM_PUBLIC const otext *OCI_API OCI_GetServiceName | ( | OCI_Connection * | con | ) |
#include <api.h>
Return the Oracle server service name of the connected database.
| con | - Connection handle |
Referenced by ocilib::Connection::GetService().
| OCI_SYM_PUBLIC const otext *OCI_API OCI_GetServerName | ( | OCI_Connection * | con | ) |
#include <api.h>
Return the Oracle server machine name of the connected database.
| con | - Connection handle |
Referenced by ocilib::Connection::GetServer().
| OCI_SYM_PUBLIC const otext *OCI_API OCI_GetDomainName | ( | OCI_Connection * | con | ) |
#include <api.h>
Return the Oracle server domain name of the connected database.
| con | - Connection handle |
Referenced by ocilib::Connection::GetDomain().
| OCI_SYM_PUBLIC OCI_Timestamp *OCI_API OCI_GetInstanceStartTime | ( | OCI_Connection * | con | ) |
#include <api.h>
Return the date and time (Timestamp) at which the server instance was started.
| con | - Connection handle |
Referenced by ocilib::Connection::GetInstanceStartTime().
| OCI_SYM_PUBLIC boolean OCI_API OCI_IsTAFCapable | ( | OCI_Connection * | con | ) |
#include <api.h>
Check if the given connection supports Transparent Application Failover (TAF) events.
| con | - Connection handle |
Referenced by ocilib::Connection::IsTAFCapable().
| OCI_SYM_PUBLIC boolean OCI_API OCI_SetTAFHandler | ( | OCI_Connection * | con, |
| POCI_TAF_HANDLER | handler | ||
| ) |
#include <api.h>
Set the Transparent Application Failover (TAF) user handler.
| con | - Connection handle |
| handler | - Pointer to the TAF handler procedure (see POCI_TAF_HANDLER) |
Referenced by ocilib::Connection::SetTAFHandler().
| OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetStatementCacheSize | ( | OCI_Connection * | con | ) |
#include <api.h>
Return the maximum number of statements to keep in the statement cache.
| con | - Connection handle |
Referenced by ocilib::Connection::GetStatementCacheSize().
| OCI_SYM_PUBLIC boolean OCI_API OCI_SetStatementCacheSize | ( | OCI_Connection * | con, |
| unsigned int | value | ||
| ) |
#include <api.h>
Set the maximum number of statements to keep in the statement cache.
| con | - Connection handle |
| value | - Maximum number of statements in the cache |
Referenced by ocilib::Connection::SetStatementCacheSize().
| OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetDefaultLobPrefetchSize | ( | OCI_Connection * | con | ) |
#include <api.h>
Return the default LOB prefetch buffer size for the connection.
| con | - Connection handle |
Referenced by ocilib::Connection::GetDefaultLobPrefetchSize().
| OCI_SYM_PUBLIC boolean OCI_API OCI_SetDefaultLobPrefetchSize | ( | OCI_Connection * | con, |
| unsigned int | value | ||
| ) |
#include <api.h>
Enable or disable prefetching for all LOBs fetched in the connection.
| con | - Connection handle |
| value | - Default prefetch buffer size |
Referenced by ocilib::Connection::SetDefaultLobPrefetchSize().
| OCI_SYM_PUBLIC unsigned int OCI_API OCI_GetMaxCursors | ( | OCI_Connection * | con | ) |
#include <api.h>
Return the maximum number of SQL statements that can be opened in one session.
| con | - Connection handle |
Referenced by ocilib::Connection::GetMaxCursors().