Use OTL to access the database-take the wife to the street-C ++ blog

Source: Internet
Author: User
Tags informix interbase

Use OTL to access the database-take the wife to the street-C ++ blog

Use OTL to access the database

Source: http://read.newbooks.com.cn/info/157869.html

OTL introduction:
OTL Yes Oracle, ODBC and DB2-CLI template library abbreviation, is a C ++ template library for controlling relational databases during compilation. It currently supports almost all mainstream databases, example: Oracle, ms SQL Server, Sybase, Informix, MYS Ql, DB2, Interbase/Firebird, PostgreSQL, SQLite, SAP/DB, TimesTen, MS access and so on. OTL Oracle mainly uses Oracle provides the OCI API, the DB2 database is performed through the CLI interface, for MS databases and other databases, OTL only supports odbc . Of course, Oracle and DB2 can also be OTL is indirectly manipulated using odbc .

InWindows and Unix MSPlatform,OTLCurrently, the following database versions are supported:Oracle 7 (Direct useOci7), Oracle 8 (Direct useOci8), Oracle 8i (Direct useOci8i), Oracle 9i (Direct useOci9i), Oracle 10g (Direct useOci10g), DB2 (Direct useDB2 CLI, ODBC 3.x, ODBC 2.5.OTLThe latest version is4.0, SeeHttp://otl.sourceforge.net/,Http://otl.sourceforge.net/otlv4_h.zip.
Advantages:
A. Cross-platform
B. High operation efficiency, andCDirect language callAPIEquivalent
C. High development efficiency
D. Easy to deploy, no needADOComponent, not required. NET FrameworkAnd so on
  Currently501Examples can be referredHttp://otl.sourceforge.net/otl4_mssql_examples.htm.

 

OTLUse:

OTLEasy to use, use different database connections (connection string format can refer to: http://www.connectionstrings.com/), mainly according to the needs inProgramMacro definition to specify.OTLFirst, initialize the database connection environment according to the macro definition.OTLThe following macro definitions are used to differentiate Connection Methods::
Otl_ora7, otl_ora8, otl_odbc, otl_db2_cli, otl_odbc_mysql...

Databases corresponding to different macrosAPI, The details are described as follows:

 

Macro definition name

Description

Otl_db2_cli

ForDB2Call level interface (CLI)

Otl_informix_cli

For Informix call level interface for Unix (whenOtl_odbc_unixIs Enabled ).

Otl_iodbc_bsd

For ODBC on bsd unix, when iodbc package is used

Otl_odbc

For ODBC

Otl_odbc_mysql

ForMyodbc/MySQL. The difference between otl_odbc_mysql and otl_odbc is that transactional ODBC function CILS are turned off for otl_odbc_mysql, since MySQL does not have transactions

Otl_odbc _
PostgreSQL

For the PostgreSQL ODBC driver 3.5 (and higher) that are 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 that the ODBC driver is the only open source ODBC driver for InterBase. other drivers, like easysoft's ODBC for Interbase, are using cial products, and it beats the purpose of using INTERBASE, as an open source. database server.

Otl_ora7

For oci7

Otl_ora8

For oci8

Otl_ora8i

For oci8i

Otl_ora9i

For oci9i. All code that compiles and works under # define otl_ora7, otl_ora8, and otl_ora8i, shocould work when otl_ora9i is used

Otl_ora10g

For oci10g. All code that compiles and works under # define otl_ora7, otl_ora8, otl_ora8i, otl_ora9i, shoshould work with otl_ora10g.

Otl_ora10g_r2

For oci10g, Release 2 (Oracle 10.2). All code that compiles and works under # define otl_ora7, otl_ora8, otl_ora8i, otl_ora9i, and otl_ora10g shocould work with orders.

 

CompileOTLYou need to use the corresponding databaseAPIThis requires the program to be connected during compilation.LibLibrary files, corresponding to different databasesLibThe file location is different.WindowsAndUNIXDatabase UnderAPIHeader files andLibFile Location list:

 

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

 

 

 

IfWindowsLower-level operationsMSOf Database, useMs vc ++To compileOTLProgram, it is very simple, do not need to find anotherOdbc32.lib,VCIs already default in the compilerLinkIt is in the project. For details, see how to compileOTL:Http://otl.sourceforge.net/otl3_compile.htm.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.