Embedded Dynamic Versus Call-Level Interface

Team-Fly    

 
DB2 Universal Database for OS/390 v7.1 Application Certification Guide
By Susan Lawson
Table of Contents
Chapter 11.  ODBC/CLI Programming

Embedded Dynamic Versus Call-Level Interface

Traditional DB2 access facilities like CAF, DSN (TSO), IMS, and CICS use embedded SQL in application programs. This embedded SQL is usually static, but may contain dynamic statements. Dynamic SQL is executed using the PREPARE, EXECUTE and EXECUTE IMMEDIATE statements. Like static statements, these dynamic statements require precompilation and binding to the database to form a package or plan. More information about embedded dynamic SQL is available in Chapter 6, "Binding an Application Program."

DB2 ODBC data access is always dynamic and does not require precompilation or binding for the application program. This facilitates the migration of programs across platforms, because they execute the same and use the same database interfaces. Programs that use the ODBC and CLI interfaces do not need any embedded SQL statements and are compiled the same way whether the data source is DB2 or another DBMS.

PREPARE and EXECUTE are normal SQL statements, and the only way to execute a statement is to create a DBRM using the preprocessor and bind them as a plan or package. The bind for PREPARE and EXECUTE will be extremely fast, because the optimizer cannot optimize anything for these statementsall the work is done at runtime.

Now, why is it that programs that use DB2 ODBC do not have to bind anything? This is because at runtime your program calls the functions of DB2 ODBC. These functions use statements that are part of a standard plan used by this interface. For OS/390, this plan is called DSNACLI.

A DB2 ODBC program can use embedded SQL as well as ODBC function calls. Mixed-mode programs like these require their own package, a plan that includes that package, and the DB2 ODBC packages as well.


Team-Fly    
Top


DB2 Universal Database for OS. 390 v7. 1 Application Certification Guide
DB2(R) Universal Database for OS/390 V7.1 Application Certification Guide (IBM DB2 Certification Guide Series)
ISBN: 0131007718
EAN: 2147483647
Year: 2002
Pages: 163
Authors: Susan Lawson

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net