OracleDB23ai For C Developers
OracleDB23ai For C Developers
Developers
June, 2025, Version 1.0
Copyright © 2025, Oracle and/or its affiliates
Public
Disclaimer
This document in any form, software, or printed matter, contains proprietary information that is the exclusive
property of Oracle. Your access to and use of this confidential material is subject to the terms and conditions of
your Oracle software license and service agreement, which has been executed and with which you agree to
comply. This document and information contained herein may not be disclosed, copied, reproduced, or
distributed to anyone outside Oracle without prior written consent of Oracle. This document is not part of your
license agreement, nor can it be incorporated into any contractual agreement with Oracle or its subsidiaries or
affiliates.
This document is for informational purposes only and is intended solely to assist you in planning for the
implementation and upgrade of the product features described. It is not a commitment to deliver any material,
code, or functionality, and should not be relied upon in making purchasing decisions. The development, release,
timing, and pricing of any features or functionality described in this document remains at the sole discretion of
Oracle. Due to the nature of the product architecture, it may not be possible to safely include all features
described in this document without risking significant destabilization of the code.
Purpose 4
Introduction 5
AI Vector Search and the VECTOR Data Type 5
The VECTOR Data Type 5
Enriched Development Experience 7
The Native BOOLEAN Data Type 7
SQL Annotations 7
Data Use Case Domains 9
String Indexed PL/SQL Associative Arrays 9
JSON Schema Validation 9
Cloud Computing and Multi-Cloud 9
Centralized Configuration Providers 9
IAM Token-based Authentication with Oracle Cloud 10
OAUTH2 Token-based Authentication with Microsoft Azure 10
Performance and Scalability 11
Pipelining 11
Efficient Table DDL Change Notification 12
Sessionless Transactions 12
Connection Pooling Enhancements 14
Implicit Connection Pooling with DRCP 15
Multi-pool DRCP (Named Pools) 15
Client Result Cache Enhancements 15
Diagnosability 16
Dynamic Client-Side Tracing 16
Session Pool Statistics 16
Security 16
Token-based Authentication with Oracle Cloud’s IAM and Microsoft
Entra ID’s OAUTH2 support 16
Support for Longer Passwords 16
Availability 17
Resumable Cursors and Request Boundaries 17
Conclusion 17
Vectors are widely used to capture important characteristics of unstructured data such as text, images, audio,
videos, and IoT data. Vectors are typically generated using machine learning (ML) embedding models.
Oracle AI Vector Search allows context analysis and similarity search, i.e., the semantic relationship between
objects (words, phrases, images, and so on).
OCI supports all the VECTOR column types: BINARY, INT8 (8-bit integer), FLOAT32 (32-bit floating point
number), and FLOAT64 (64-bit floating point number) in their SPARSE and DENSE representations. All the
floating-point numbers are represented in IEEE format. Here is a sample table with a VECTOR column:
In this example, each vector in the embedding VECTOR column has 10 dimensions, and each dimension is an 8-
bit integer.
Here is a sample OCI code snippet to select vectors from the my_vectors table created in the earlier section
and fetching the vector data as a string using the OCIVectorToText()function:
OraText vtext[UB2MAXVAL];
ub4 vtextlen;
OCIInd ind1 = 0;
(ub4)strlen(selstmt), NULL, 0,
(ub4)OCI_NTV_SYNTAX, (ub4)OCI_DEFAULT);
vtextlen = str_size;
The above snippet prints the vector value returned from the first row of the my_vectors table as a string
representing an array of numbers.
For fetching vector values into an array, the appropriate result array and vector dimension size needs to be set.
See the example below, which uses the OCIVectorToArray()function to fetch INT8 values from the
my_vectors table created in the earlier section:
OCIEnv *envhp = (OCIEnv *) NULL;
OraText vtext[UB2MAXVAL];
int i;
OCIInd ind1 = 0;
(ub4)strlen(selstmt), NULL, 0,
(ub4)OCI_NTV_SYNTAX, (ub4)OCI_DEFAULT);
6 Oracle Database 23ai for C Developers/ Version 1.0
Copyright © 2025, Oracle and/or its affiliates / Public
OCIDescriptorAlloc(ociEnv, (void**) &vecp, OCI_DTYPE_VECTOR, 0, 0);
The above code snippet prints each INT8 vector value returned from the first row of the my_vectors table.
Note that the output array (viarr) size and the vdim value should match the number of vector dimensions of the
vector column being fetched (10 in this case).
See the Oracle Call Interface Vector documentation for more details.
For reads (OCI defines) and writes (OCI binds) of SQL BOOLEAN data type, SQLT_BOL is the data type constant.
Below is a sample code snippet for binding a SQL BOOLEAN data type:
#include <stdbool.h>
SQL Annotations
A database table, view or column can be associated with application metadata or annotations thereby allowing
central management of changes. An individual annotation has a name (key) and an optional value.
OCI now supports describing annotations for columns, tables, and views.
Check for the following sample pseudocode for retrieving annotations in OCI:
text *key;
text *value;
ub4 num_annotations = 0;
ub4 i;
ub4 status;
// ...
if (num_annotations) {
Note: A sample user-defined checkerr() function to check and throw the appropriate OCI error message is
available here.
See the Oracle Call Interface Annotations documentation for more details.
With Data Use Case Domains, you can define how you intend to use data centrally. They make it easier to ensure
you handle values consistently across applications and improve data quality.
This feature enables a more straightforward and less error-prone code development.
OCI also provides an attribute OCI_ATTR_HAS_JSON_SCHEMA checks to find if a column has an IS JSON schema
constraint.
For complete details on OCI Centralized Configuration Provider support, see OCI Support for Centralized
Configuration Store documentation.
For more details on these attributes, check out the Authentication Information Handle Attributes documentation.
Note that the Oracle Cloud’s IAM tokens are short-lived with a default expiry time of 60 minutes. They need to be
renewed after expiring.
You can pass the Oracle Cloud’s IAM token to the OCI functions in two ways:
At deployment without application change: The token should be stored in a token file whose location is
provided as an input to the OCI functions. A token file should contain only one token corresponding to an
IAM user.
OCI also provides High Availability support for OCI IAM Authentication.
OCI provides the following attributes for OAUTH2 token authentication that can be set on the authentication
handle or the user session handle:
OCI_ATTR_TOKEN (mandatory)
OCI_ATTR_TOKEN_ISBEARER (mandatory and must be set to TRUE)
OCI_ATTR_TOKEN_CBK
OCI_ATTR_TOKEN_CBKCTX
Ensure that the OCI_ATTR_TOKEN_ISBEARER attribute value is set to TRUE in the case of Microsoft Entra ID as it
supports only Bearer OAUTH2 access tokens at the time of writing this document. The OAUTH2 token is passed
as an attribute value to OCI_ATTR_TOKEN using the OCIAttrGet() function.
OCI also provides TAF, AC & TAC2 High Availability (HA) support for Microsoft Entra ID’s Bearer OAUTH2 Token
authentication. In the case of a connection failover with tokens present in an external location, the tokens are
1
IAM – Identity Access Management
2
TAF – Transparent Application Failover, TAC – Transparent Application Continuity, AC – Application Continuity
10 Oracle Database 23ai for C Developers/ Version 1.0
Copyright © 2025, Oracle and/or its affiliates / Public
retrieved by the HA mechanisms of Oracle Database from the token location provided in the connect string or in
the network configuration files.
Pipelining
Oracle Database 23ai introduced pipelining support for database operations to boost the overall responsiveness
and throughput of the database connections from various client applications. The basic idea of pipelining is to
keep the database server occupied and allow an application to interleave database requests, responses, and local
work appropriately. Pipelining ensures that both the application and database server idle times are optimized to a
minimum. Pipelined database operations foster an asynchronous programming model, in which an application
user request returns immediately upon submitting a SQL statement for execution without waiting for the
database response.
As the application keeps sending requests, the database server builds up a request queue and executes them one
by one. The server sends the responses back to the application in the same order in which it received the
requests.
The application must ensure that the requests are independent of each other for the pipeline functionality to work
correctly.
The following diagram provides an insight into the internal implementation of OCI’s pipeline support in a sample
scenario:
In the preceding diagram, database requests 1 and 2 have been processed and the responses are being sent
to the application. Database requests 3 to 6 sent by the application are being queued in the database server-
side pipeline. The database will next process request 3 from its pipeline. At the same time, the application
sends request 7 to the queue to be processed.
int status;
See the Oracle Call Interface Pipelining documentation and Veronica Dumitriu’s OCI pipelining blog for more
details.
Applications seeking table metadata or caching table metadata in the middle-tier can use Table DDL Change
Notification instead of continuously polling for DDL changes. Thus, applications implementing this feature can
benefit from reduced network round trips to the database.
OCI also provides DDL Event Descriptor attributes that provides metadata about DDL events, which can be
fetched using the OCIAttrGet() function.
See the Table DDL Change Notification documentation for more details.
Sessionless Transactions
The Sessionless Transactions feature introduced in Oracle Database 23ai enables users to start a transaction on a
database session, submit a unit of work, suspend the transaction, and continue the same transaction on another
session. The coordination is done by passing a user-chosen globally unique transaction identifier. At the end, the
same transaction can be committed from yet another session. Sessionless Transactions can be started on both
the database server side and the client side (like OCI applications).
OCI enables C developers to start, suspend, and resume Sessionless Transactions using its APIs for Transaction
Functions.
As a prerequisite, you must allocate a transaction handle and set it as the OCI_ATTR_TRANS attribute of the
service context handle:
OCIStmt *stmthp;
sword status;
// ...
/*
*/
// ...
OCI_ATTR_TRANS_NAME, errhp);
// ...
if (status != OCI_SUCCESS) {
/* Add code to release and detach all handles and free memory */
// ...
Note: A sample user-defined checkerr() function to check and throw the appropriate OCI error message is
available here.
Every Sessionless Transaction is identified by a unique transaction identifier called a Global Transaction ID
(GTRID).
OCI can provide or use an Oracle Database-generated GTRID to identify the Sessionless Transaction to be started.
See Oracle Documentation set a Global Transaction ID (GTRID) using OCI.
As of Oracle Database 23ai, Release Update 23.6, when you resume a Sessionless Transaction, the timeout
setting is ignored.
A Sessionless Transaction can be ended by all the usual means that end a local transaction in OCI. For committing
a Sessionless Transaction, OCITransCommit(), and OCIStmtExecute() in OCI_COMMIT_ON_SUCCESS
mode can be used. Sessionless Transactions can be rolled back by all the usual means that end a local transaction
in OCI, such as, OCITransRollback() and OCIRequestEnd().
See the OCI Documentation on Transaction Functions for the complete details.
The major new DRCP features in Oracle Database 23ai include Implicit Connection Pooling and Multi-pool DRCP.
These features require only connect string changes on the OCI application side.
On the OCI application side, the user just needs to set the POOL_BOUNDARY option in the connect string to enable
it to work with Implicit Connection Pooling. The POOL_BOUNDARY option can have two values:
STATEMENT – This tells DRCP to perform an 'implicit release' when the database session is stateless
TRANSACTION – This tells DRCP to perform an 'implicit release' at commit/rollback or when the database
session is stateless. This release will close any active cursors, temporary tables, and temporary LOBs in
case of commit/rollback.
Here is a sample connect string with Implicit Connection Pooling with the STATEMENT POOL_BOUNDARY option:
DBServerPool =
(DESCRIPTION =
(ADDRESS=(PROTOCOL=tcp)(HOST=oraclehost)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=db_svc_name)
(SERVER=POOLED)(POOL_BOUNDARY=STATEMENT))
Implicit Connection Pooling with DRCP provides the following benefits for applications:
Improved scalability for applications through better multiplexing
Reduced pool handling required on the application side
Supports higher concurrency for mid-tiers through optimal database resource usage
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oraclehost)(PORT=port_number))
(CONNECT_DATA=(SERVICE_NAME=db_service.company.com>)(SERVER=POOLED)
(POOL_NAME=my_pool)))
Multi-pool DRCP provides configuration flexibility to Database Administrators and helps organize the database
connections based on the type of incoming application requests.
Starting from Oracle Database 23ai - Release Update 23.7, OCI provides CRC support for
OCITraceEventSet()
OCITraceEventReset()
OCITraceWriteMessage()
The new dynamic tracing feature also enables developers to write custom messages in the trace files.
These new APIs enable diagnostics to be configured dynamically in the application without the need to update
configuration files or set environment variables.
In earlier OCI versions, diagnostic client-side tracing was enabled/disabled by setting the parameter
EVENT_10842 in the sqlnet.ora network configuration file. Applications had to restart after making any change in
the sqlnet.ora file.
The dynamic client-side tracing feature improves OCI application troubleshooting and reduces problem resolution
time for clients in OCI applications.
OCI_ATTR_SPOOL_WAIT_COUNT - Returns the number of active client requests that are currently
waiting due to the non-availability of free server connections
OCI_ATTR_SPOOL_HIT_COUNT - Returns the total number of times client requests are found that
match the requests in the session pool out of all the client requests
OCI_ATTR_SPOOL_HISTMAX_COUNT - Returns the maximum size that the pool has ever reached
Security
The latest set of security-related enhancements in OCI brings in greater password security, entropy, and support
for the latest password complexity rules in Oracle Cloud Database services. C applications can build more secure
solutions with the latest updates in Oracle Database 23ai release.
Availability
Application Continuity (AC) and Transparent Application Continuity (TAC) are high availability and zero-downtime
features of Oracle Database that hide database instance or network failures from C applications. These features
straddle both the database server and OCI client driver.
With AC/TAC, OCI makes high-availability (zero-downtime) the most transparent possible for C applications with
support for resumable cursors and defining explicit request boundaries within a session from Oracle Database
23ai onwards.
The OCI APIs OCIRequestBegin() and OCIRequestEnd() establish explicit request boundaries that
demarcate the beginning and end of an application unit of work, encompassing all session cursors (including SSS
cursors) without use of the OCI Session Pool. Note that OCIRequestBegin() validates the connection by
internally checking the OCI_ATTR_SERVER_STATUS attribute. This attribute is updated based on a lightweight
connection health check inband notifications and FAN event notifications. OCIRequestBegin() initiates failover if
the health check fails and the interval value set in the new OCI_ATTR_PING_INTERVAL attribute is expired.
The session state stability is set and maintained by the new OCI_ATTR_SESSSTATE_CONSISTENCY attribute.
Please check the OCI Documentation on this attribute for more details.
Applications that have their own custom pool implementations (instead of using OCI session pools) for database
connections can call the OCIRequestBegin() and OCIRequestEnd() APIs to to integrate with AC and DRCP.
These applications can also use these APIs to proactively respond to planned maintenance activities by ensuring
that an application request starts with a healthy connection. These methods can also be used with applications
that keep standalone connections open but do not often execute the database operations. However, it is
recommended that applications use OCI session pooling as a preference over custom pools or the
OCIRequestBegin() and OCIRequestEnd() APIs, wherever possible.
Conclusion
Oracle Database 23ai has released an exciting array of new features for Artificial Intelligence, Cloud Operations,
Application Development, Security, and Connection Management that can be leveraged by OCI applications. In
addition to the features mentioned in these documents, OCI can make use of new Oracle Database 23ai
optimizations and features like Fast Connect, Implicit Connection Pooling with DRCP, Multi-pool DRCP etc.
without any application-side code changes. Oracle Database 23ai’s new Error Help URL provides enhanced
troubleshooting capabilities to developers. Overall, these new OCI features will undoubtedly help you design and
deploy modern C applications, which are faster, smarter, and more efficient.
Call +1.800.ORACLE1 or visit oracle.com. Outside North America, find your local office at: oracle.com/contact.
Copyright © 2025, Oracle and/or its affiliates. This document is provided for information purposes only, and the contents hereof are subject to change without notice. This document
is not warranted to be error-free, nor subject to any other warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of
merchantability or fitness for a particular purpose. We specifically disclaim any liability with respect to this document, and no contractual obligations are formed either directly or
indirectly by this document. This document may not be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without our prior written
permission.
Oracle, Java, MySQL, and NetSuite are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.