OCL function reference v15
The following tables list the functions supported by the EDB OCL connector. You must supply any header files. EDB Postgres Advanced Server doesn't supply header files.
Connect, authorize, and initialize functions
Function | Description |
---|---|
OCIBreak | Abort the specified OCL function. |
OCIEnvCreate | Create an OCL environment. |
OCIEnvInit | Initialize an OCL environment handle. |
OCIInitialize | Initialize the OCL environment. |
OCILogoff | Release a session. |
OCILogon | Create a logon connection. |
OCILogon2 | Create a logon session in various modes. |
OCIReset | Reset the current operation/protocol. |
OCIServerAttach | Establish an access path to a data source. |
OCIServerDetach | Remove access to a data source. |
OCISessionBegin | Create a user session. |
OCISessionEnd | End a user session. |
OCISessionGet | Get session from session pool. |
OCISessionRelease | Release a session. |
OCITerminate | Detach from shared memory subsystem. |
Using the tnsnames.ora file
The OCIServerAttach
and OCILogon
methods use NET_SERVICE_NAME
as a connection descriptor specified in the dblink
parameter of the tnsnames.ora
file. Use the tnsnames.ora
file (compatible with Oracle databases) to specify database connection details. OCL searches your home directory for a file named .tnsnames.ora
. If OCL doesn't find the .tnsnames.ora
file there, it searches for tnsnames.ora
on the path specified in TNS_ADMIN
environment variable.
You can specify multiple descriptors (NET_SERVICE_NAME)
in the tnsnames.ora
file.
The sample tnsnames.ora
file contains:
Any parameters not included in the files are ignored by the Open Client Library. In the example, SID
refers to the database named edb
in the cluster running on localhost
on port 5444
.
A C program call to OCIServerAttach
that uses the tnsnames.ora
file looks like:
If you don't have a tnsnames.ora
file, supply the connection string in the form //localhost:5444/edbx
.
Note
Multiple descriptors are also supported in tnsnames.ora
.
Handle and descriptor functions
Function | Description |
---|---|
OCIAttrGet | Get handle attributes. EDB Postgres Advanced Server supports the following handle attributes: OCI_ATTR_USERNAME, OCI_ATTR_PASSWORD, OCI_ATTR_SERVER, OCI_ATTR_ENV, OCI_ATTR_SESSION, OCI_ATTR_ROW_COUNT, OCI_ATTR_CHARSET_FORM, OCI_ATTR_CHARSET_ID, EDB_ATTR_STMT_LEVEL_TX, OCI_ATTR_MODULE |
OCIAttrSet | Set handle attributes. EDB Postgres Advanced Server supports the following handle attributes: OCI_ATTR_USERNAME, OCI_ATTR_PASSWORD, OCI_ATTR_SERVER, OCI_ATTR_ENV, OCI_ATTR_SESSION, OCI_ATTR_ROW_COUNT, OCI_ATTR_CHARSET_FORM, OCI_ATTR_CHARSET_ID, EDB_ATTR_STMT_LEVEL_TX, OCI_ATTR_MODULE, OCI_ATTR_PREFETCH_ROWS |
OCIDescriptorAlloc | Allocate and initialize a descriptor. |
OCIDescriptorFree | Free an allocated descriptor. |
OCIHandleAlloc | Allocate and initialize a handle. |
OCIHandleFree | Free an allocated handle. |
OCIParamGet | Get a parameter descriptor. |
OCIParamSet | Set a parameter descriptor. |
EDB_ATTR_EMPTY_STRINGS
By default, EDB Postgres Advanced Server treats an empty string as a NULL value. You can use the EDB_ATTR_EMPTY_STRINGS
environment attribute to control the behavior of the OCL connector when mapping empty strings. To modify the mapping behavior, use the OCIAttrSet()
function to set EDB_ATTR_EMPTY_STRINGS
to one of the following.
Value | Description |
---|---|
OCI_DEFAULT | Treat an empty string as a NULL value. |
EDB_EMPTY_STRINGS_NULL | Treat an empty string as a NULL value. |
EDB_EMPTY_STRINGS_EMPTY | Treat an empty string as a string of zero length. |
To find the value of EDB_ATTR_EMPTY_STRINGS
, query OCIAttrGet()
.
EDB_ATTR_HOLDABLE
EDB Postgres Advanced Server supports statements that execute as WITH HOLD
cursors. The EDB_ATTR_HOLDABLE
attribute specifies the statements that execute as WITH HOLD
cursors. You can set the EDB_ATTR_HOLDABLE
attribute to any of the following values:
EDB_WITH_HOLD