OCILIB (C and C++ Driver for Oracle)
4.7.5
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
|
OcilibCApiErrorHandling
Connecting to a database server is done with one call to OCI_ConnectionCreate().
OCI_ConnectionFree() closes the established connection.
Connection properties are accessible through a set of 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) |
Returns TRUE is the given connection is still connected otherwise FALSE. | |
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 to the given connection. | |
OCI_SYM_PUBLIC boolean OCI_API | OCI_SetSessionTag (OCI_Connection *con, const otext *tag) |
Associate a tag to the given connection/session. | |
OCI_SYM_PUBLIC const otext *OCI_API | OCI_GetSessionTag (OCI_Connection *con) |
Return the tag associated the given connection. | |
OCI_SYM_PUBLIC const otext *OCI_API | OCI_GetDatabase (OCI_Connection *con) |
Return the name of the connected database/service name. | |
OCI_SYM_PUBLIC const otext *OCI_API | OCI_GetUserName (OCI_Connection *con) |
Return the current logged user name. | |
OCI_SYM_PUBLIC const otext *OCI_API | OCI_GetPassword (OCI_Connection *con) |
Return the current logged user password. | |
OCI_SYM_PUBLIC boolean OCI_API | OCI_SetPassword (OCI_Connection *con, const otext *password) |
Change the password of the logged 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 given 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 (aka server banner version) 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 of the connection. | |
OCI_SYM_PUBLIC boolean OCI_API | OCI_SetTransaction (OCI_Connection *con, OCI_Transaction *trans) |
Set a transaction to a connection. | |
OCI_SYM_PUBLIC unsigned int OCI_API | OCI_GetVersionConnection (OCI_Connection *con) |
Return the highest Oracle version is supported by the connection. | |
OCI_SYM_PUBLIC boolean OCI_API | OCI_SetTrace (OCI_Connection *con, unsigned int trace, const otext *value) |
Set tracing information to the session of the given connection. | |
OCI_SYM_PUBLIC const otext *OCI_API | OCI_GetTrace (OCI_Connection *con, unsigned int trace) |
Get the current trace for the trace type from the given connection. | |
OCI_SYM_PUBLIC boolean OCI_API | OCI_Ping (OCI_Connection *con) |
Makes a round trip call to the server to confirm that the connection and the 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) |
Returns the requested timeout value for OCI calls that require server round-trips to the given database. | |
OCI_SYM_PUBLIC const otext *OCI_API | OCI_GetDBName (OCI_Connection *con) |
Return the Oracle server database name of the connected database/service name. | |
OCI_SYM_PUBLIC const otext *OCI_API | OCI_GetInstanceName (OCI_Connection *con) |
Return the Oracle server Instance name of the connected database/service name. | |
OCI_SYM_PUBLIC const otext *OCI_API | OCI_GetServiceName (OCI_Connection *con) |
Return the Oracle server service name of the connected database/service name. | |
OCI_SYM_PUBLIC const otext *OCI_API | OCI_GetServerName (OCI_Connection *con) |
Return the Oracle server machine name of the connected database/service name. | |
OCI_SYM_PUBLIC const otext *OCI_API | OCI_GetDomainName (OCI_Connection *con) |
Return the Oracle server domain name of the connected database/service name. | |
OCI_SYM_PUBLIC OCI_Timestamp *OCI_API | OCI_GetInstanceStartTime (OCI_Connection *con) |
Return the date and time (Timestamp) server instance start of the connected database/service name. | |
OCI_SYM_PUBLIC boolean OCI_API | OCI_IsTAFCapable (OCI_Connection *con) |
Verify if the given connection support 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 |
user | - Oracle User name |
pwd | - Oracle User password |
mode | - Session mode |
Possible values for parameter mode :
OCILIB supports Oracle XA connectivity. In order to get a connection using 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>
Returns TRUE is the given connection is still connected otherwise FALSE.
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
is a valid value. It returns then previously stored data with global scope (program wide) Referenced by ocilib::Environment::Cleanup(), and ocilib::Connection::GetUserData().
OCI_SYM_PUBLIC boolean OCI_API OCI_SetUserData | ( | OCI_Connection * | con, |
void * | data | ||
) |
#include <api.h>
Associate a pointer to user data to the given connection.
con | - Connection handle |
data | - User data pointer |
con
is a valid value. It allows users to associate a pointer to user data with global scope (program wide)Referenced by ocilib::Environment::Cleanup(), and ocilib::Connection::SetUserData().
OCI_SYM_PUBLIC boolean OCI_API OCI_SetSessionTag | ( | OCI_Connection * | con, |
const otext * | tag | ||
) |
#include <api.h>
Associate a tag to 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 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/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 current logged user name.
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 current logged user password.
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 logged 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 given database.
db | - Oracle Service Name |
user | - Oracle User name |
pwd | - Oracle User password |
new_pwd | - Oracle User New 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 (aka server banner version) 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 (optional) |
type | - Type of format |
format | - Format string |
Formats can set at 2 levels:
When the library needs to perform a string conversion, it search for a valid format using 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 |
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 of 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>
Set a transaction to 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 is 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 to the session of the given connection.
con | - connection handle |
trace | - trace type |
value | - trace content |
Store current trace information to the given connection handle. These information:
OCILIB truncates input values to match theses limits
Referenced by ocilib::Connection::SetTrace().
OCI_SYM_PUBLIC const otext *OCI_API OCI_GetTrace | ( | OCI_Connection * | con, |
unsigned int | trace | ||
) |
#include <api.h>
Get the current trace for the trace type from the given 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>
Makes a round trip call to the server to confirm that the connection and the 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':
OCI client raises an timeout type related error when a given timeout is reached.
Here is a 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>
Returns the requested timeout value for OCI calls that require server round-trips to the given database.
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/service name.
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/service name.
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/service name.
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/service name.
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/service name.
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) server instance start of the connected database/service name.
con | - Connection handle |
Referenced by ocilib::Connection::GetInstanceStartTime().
OCI_SYM_PUBLIC boolean OCI_API OCI_IsTAFCapable | ( | OCI_Connection * | con | ) |
#include <api.h>
Verify if the given connection support 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 TAF handler procedure |
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().