SQL Server and Embedded SQL

SQL Server Architecture

SQL Server Architecture

SQL Server and Embedded SQL

Embedded SQL (ESQL) is a SQL-92 standard application programming interface (API) for SQL database access. ESQL requires a two-step compilation process:

  1. A precompiler translates Embedded SQL statements into commands in the programming language used to write the application. The generated statements are specific to the database that supplied the precompiler, so although the original source is generic to ESQL, the generated statements and the final executable file are specific to one database vendor.

  2. The source generated by the precompiler is then compiled using the compiler for the application programming language.

Embedded SQL has a simpler syntax than COM APIs such as OLE DB or Call Level Interfaces such as ODBC, so it is easier to learn and program. It is less flexible than OLE DB or ODBC, where well-written applications can switch from one DBMS to another by simply switching drivers or providers. OLE DB and ODBC are also better at dealing with environments where the SQL statements are not known when the application is compiled, such as when developing as-required query tools.

Microsoft® SQL Server™ 2000 provides an Embedded SQL precompiler for C applications. The SQL Server precompiler translates Embedded SQL statements as calls to the appropriate DB-Library API functions. The Microsoft implementation of ESQL has the same restrictions as DB-Library applications.

SQL Server is designed such that it can support COBOL Embedded-SQL applications compiled with third-party Embedded SQL precompilers that support Microsoft SQL Server.

See Also

Programming Embedded SQL for C