Before compiling and linking the program, precompiling and binding of the
embedded SQL statements has to be done. Precompiling converts
embedded SQL statements into DB2 run time API calls that a host compiler
can process, and then creates a bind file. The
bind
command creates a
package in the database. This package then contains the SQL operation and
the access plan that DB2 will use to perform the operation.
Dynamic SQL
Dynamic SQL statements in an application are built and executed at runtime.
For a dynamically prepared SQL statement, the syntax has to be checked and
an access plan has to be generated during the program execution.
Examples of embedded static and dynamic SQL can be found in the DB2
home directory:
sqllib/samples/
.
DB2 Call Level Interface (DB2 CLI)
DB2 CLI is a programming interface that can be used from C and C++
applications to access DB2 databases. DB2 CLI is based on the Microsoft Open
Database Connectivity (ODBC) specification, and the ISO CLI standard. The
DB2 CLI library
can be loaded as an ODBC driver by an ODBC driver manager.
DB2 CLI includes support for many ODBC and ISO SQL/CLI functions, as well as
DB2 specific functions.
When using DB2 CLI, the application passes dynamic SQL statements as
function arguments to the database manager for processing. Because of this,
applications use common access packages provided with DB2, DB2 CLI
applications do not need to be precompiled or bind. Only compiling and linking of
the application is needed. Before DB2 CLI or ODBC applications can access
DB2 databases, the DB2 CLI binds files that come with the DB2 Application
Development Client to each DB2 database that will be accessed. This occurs
automatically with the execution of the first statement.
Typically, when building an ODBC application, an ODBC driver manager is
needed, which are normally provided by platform vendors like Microsoft or
others. There is also an ODBC driver manager for Linux available, which can be
found at
http://www.unixodbc.org/
. However, in environments without an
ODBC driver manager, DB2 CLI is a self sufficient driver, which supports a
subset of the functions provided by the ODBC driver. Examples of C programs
using CLI calls can be found in the DB2 home directory:
sqllib/samples/cli
For
additional information regarding CLI, refer to
Call Level Interface Guide and
Reference
, Volume 1 and Volume 2, SC09 4849 and SC09 4850.
Java Database Connectivity application (JDBC)
DB2's Java support includes JDBC, a vendor neutral dynamic SQL interface that
provides data access to the application through standardized Java methods.
Chapter 1. Introduction
25
footer
Our partners:
PHP: Hypertext Preprocessor Cheap Web Hosting
JSP Web Hosting
Ontario Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Java Hosting
Cheapest Hosting
Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved