OTL support v15
Oracle Template Library (OTL) is a C++ library for database access. It consists of a single header file. To know more about OTL, see the Oracle, Odbc and DB2-CLI Template Library Programmer's Guide.
OTL certification
The EDB OCL Connector, version 13.1.4.2, is certified with OTL 4.0. To use OTL-supported data types and for other OTL-specific behavior, define the OTL environment variable (the value isn't important) on the shell before running an OTL-based app. For example, you can export OTL=TRUE
for conditional execution of scenarios that are related to OTL.
EDB OCL Connector is certified with the following OTL features:
- Connect, disconnect, commit, and roll back using
otl_connect
. - Constant SQL statements using the static function
otl_cursor::direct_exec
. (A SQL statement is constant if it doesn't have any bind variables.) It includes most DDL statements likeCREATE TABLE
andCREATE PROCEDURE/FUNCTION
. - SQL statements with bind variable using
otl_stream class
. It includes most DML statements likeSELECT
,UPDATE
,DELETE
,INSERT
, andPROCEDURE/FUNCTION
calls. - Date/Time data types using
otl_datetime
. - Raw/Long Raw data types using
otl_long_string
. - Ref cursors using
otl_refcur_stream
.
Connect and log in
This example initializes OCL and connects to a database using a tnsnames.ora
-based connection string:
CREATE TABLE, INSERT, and SELECT
This example uses otl_cursor::direct_exec
to create a table and then insert a row in the table. You can then use otl_stream
to retrieve the inserted row.