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:
- 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.
- 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.
While the Embedded SQL for C API is still supported in Microsoft SQL Server 2000, no future versions of SQL Server will include the files needed to do programming work on applications that use this API. Connections from existing applications written using Embedded SQL for C will still be supported in the next version of SQL Server, but this support will also be dropped in a future release. When writing new applications, avoid using Embedded SQL for C. When modifying existing applications, you are strongly encouraged to remove dependencies on Embedded SQL for C. Instead of Embedded SQL for C, you can use Microsoft ActiveX® Data Objects (ADO), OLE DB, or ODBC to access data in SQL Server.