Migrating ESQL/C to ODBC API in C/C++ Applications

What is ESQL/C?

Embedded SQL (ESQL/C) is a SQL-92 standard application programming interface (API) for SQL database access. Microsoft SQL Server 2000 provides an Embedded SQL precompiler for C/C++ applications. The SQL Server precompiler translates Embedded SQL statements as calls to the appropriate DB-Library API functions.

Why to Migrate?

  • Unavailability of technical documentation for ESQL API.
  • Microsoft announced cancellation of ESQL/C in the coming SQL Server releases
  • Microsoft encourages removing dependencies on ESQL/C in existing C/C++ applications and use OLE DB or ODBC access data in SQL Server


Conversion features

SQLWays automates the following conversion features:

  • Adds the include files for ODBC API functions and structures:
    • #include <windows.h>
    • #include <sqlext.h> (automatically includes "sql.h" and "sqltypes.h")
  • Converts ESQL/C database connection - EXEC SQL CONNECT TO to ODBC connectionlike:
    • Allocates environment handle
    • Allocate connection handle
    • Establishes a connection using functions:
      • SQLConnect()
      • SQLDriverConnect()
      • SQLBrowseConnect()
  • Converts ESQL/C Error Handling - SQLCODE variable and SQLCA structure to ODBC Error Handling- SQLGetDiagRec() function
  • Converts ESQL/C EXEC SQL statements for operation with data to corresponding ODBC API functions:
    • SQLPrepare()
    • SQLExecute()
    • SQLBindParameter()
    • SQLFetch()
    • Etc.

How to convert?

Please take a look at the related article:

Embedded SQL and Database Access API Migration

If you use SQLWays Studio, you need to specify the following settings:

Source: C++
Source Database: Microsoft SQL Server
Source Database API: ESQLC


Target: C++
Target Database: Microsoft SQL Server
Target Database API: ODBC

SQLWays automates the entire migration of Embedded SQL (ESQL/C) to ODBC API. This allows you to dramatically decrease conversion risks and significantly reduce in-house efforts. Reasonable pricing strategy makes SQLWays even more powerful instrument for such migration type.

If you are interested in these services, please contact us for more information.