OTL Introduction:
OTL is an abbreviation for Oracle, the ODBC and Db2-cli Template Library, which is a templates repository for manipulating relational databases in C + + compilation, which currently supports virtually all current mainstream databases such as Oracle, MS SQL Server, Syba SE, Informix, MySQL, DB2, Interbase/firebird, PostgreSQL, SQLite, sap/db, TimesTen, MS access, and more. Direct operation in OTL Oracle is performed primarily through the OCI interface provided by Oracle, and the operation of the DB2 database is performed via the CLI interface, and for MS databases and some other databases, OTL only provides the way ODBC operates. Of course, Oracle and DB2 can also be manipulated by OTL indirectly using ODBC.
Under the MS Windows and Unix platform, OTL currently supports the following database versions: Oracle 7 (direct use of OCI7), Oracle 8 (direct use of OCI8), Oracle 8i (directly using oci8i), Oracle 9i (direct Using oci9i), Oracle 10g (directly using oci10g), DB2 (directly using the DB2 CLI), ODBC 3.x, ODBC 2.5. OTL The latest version is 4.0, see Http://otl.sourceforge.net/,http://otl.sourceforge.net/otlv4_h.zip.
Advantages:
A. Cross-platform
B. High operational efficiency, comparable to the C language direct call API
C. High development efficiency
D. Easy deployment, no ADO components required, No. NET Framework, etc.
There are now 501 examples of use available for reference http://otl.sourceforge.net/otl4_mssql_examples.htm.
Use of OTL:
OTL is very simple to use, using a different database connection (the connection string format can be referred to as: http://www.connectionstrings.com/), mainly based on the need to start the macro definition of the program to specify. OTL is the first to initialize the database connection environment based on this macro definition. The following are the main macro definitions used in OTL to differentiate connection methods:
Otl_ora7, Otl_ora8, Otl_odbc, OTL_DB2_CLI, Otl_odbc_mysql ...
Different macros correspond to the database API, as follows:
Macro Definition Name |
Description |
Otl_db2_cli |
For DB2 call Level Interface (CLI) |
Otl_informix_cli |
For Informix call level Interface for Unix (when Otl_odbc_unix is enabled). |
Otl_iodbc_bsd |
For ODBC in BSD Unix, when IODBC package is used |
Otl_odbc |
For ODBC |
Otl_odbc_mysql |
For Myodbc/mysql. The difference between Otl_odbc_mysql and Otl_odbc is the transactional ODBC function calls be turned off for otl_odbc_m Ysql, since MySQL does not has transactions |
Otl_odbc_ POSTGRESQL |
For the PostgreSQL ODBC driver 3.5 (and higher), that is connected to Postgersql 7.4/8.0 (and higher) servers. |
Otl_odbc_unix |
For ODBC bridges in Unix |
Otl_odbc_zos |
For ODBC on IBM ZOS. |
Otl_odbc_xtg_ibase6 |
For Interbase 6.x via XTG Systems ' ODBC driver. The reason for introducing this #define is, the ODBC driver is the only Open Source ODBC driver for Interbase. Other drivers, like Easysoft's ODBC for Interbase, is commercial products, and it beats the purpose of using Interbase, a s an Open source.database server. |
Otl_ora7 |
For OCI7 |
Otl_ora8 |
For OCI8 |
otl_ora8i |
For oci8i |
Otl_ora9i |
For oci9i. All code this compiles and works under #define OTL_ORA7, Otl_ora8, and otl_ora8i, should work while otl_ora9i is used |
otl_ora10g |
For oci10g. All code this compiles and works under #define OTL_ORA7, Otl_ora8, otl_ora8i, otl_ora9i, should work with otl_ora10g. |
Otl_ora10g_r2 |
For oci10g, Release 2 (Oracle 10.2). All code this compiles and works under #define OTL_ORA7, Otl_ora8, otl_ora8i, otl_ora9i, and otl_ora10g should work with Otl_ora10g_r2. |
When compiling OTL program, need to use to the corresponding database API, this will be the program at compile time to join Lib library files, different database corresponding lib file location varies, The following is a list of the header files and the location of the Lib files that are required for the database API under Windows and UNIX, respectively:
Api |
API header files for Windows |
API Libraries for Windows |
OCI7 |
In <oracle_home>/oci/include |
<oracle_home>/oci/lib/<compiler_specific>/ociw32.lib |
OCI8 |
In <oracle_home>/oci/include |
<oracle_home>/oci/lib/<compiler_specific>/oci.lib |
oci8i |
In <oracle_home>/oci/include |
<oracle_home>/oci/lib/<compiler_specific>/oci.lib |
Oci9i |
In <oracle_home>/oci/include |
<oracle_home>/oci/lib/<compiler_specific>/oci.lib |
oci10g |
In <oracle_home>/oci/include |
<oracle_home>/oci/lib/<compiler_specific>/oci.lib |
Odbc |
Normally, in one of the C + + compiler system directories, no need to include explicitly. |
Normally, in one of the C + + compiler system Directories:odbc32.lib |
DB2 CLI |
In <db2_home>/include |
<db2_home>/lib/db2api.lib <db2_home>/lib/db2cli.lib |
If you manipulate MS's database under Windows, use MS VC + + to compile the OTL program, it is very simple, do not have to find the ODBC32.LIB,VC compiler has the default link to the project, specifically see how to compile otl:http:// Otl.sourceforge.net/otl3_compile.htm.
http://blog.csdn.net/kl222/article/details/7439900
OTL Library (not previously known to have this library, and can also be used under Unix)