Embedded SQL

In previous chapters, we discussed the ODBC and JDBC APIs. This chapter discusses the scope, principles, processing and structure of embedded SQL (ESQL).

ESQL enables you to code SQL statements in a host program written in C/C++, COBOL or FORTRAN. You can specify SQL statements directly in the host program's source code. However, because the host language's compiler won't recognize the SQL statements as valid, a preprocessor is required.

The Scope of Embedded Mimer SQL

The following groups of SQL statements are common to ESQL and interactive SQL:

Data manipulation statements for reading or changing the content of the database and invoking stored routines. These are basically similar between interactive SQL and ESQL, but differ in certain details as a result of the different environments in which the statements are used.

Procedure control statements for performing operations that occur specifically within stored routines and triggers.

Transaction control statements for grouping database operations in transactions (indivisible units of work).

Access control statements for allocating privileges and access rights to users of the system. These are identical between interactive SQL and ESQL.

Data definition statements for creating and altering objects in the database. These are identical between interactive SQL and ESQL.

Connection statements for identifying the current user of the system.

System administration statements for controlling the availability of the database and its physical components, managing backups and updating database statistics.

Declarations for variables, conditions, cursors and handlers occurring within stored routines or triggers.