Previous Topic Next topic Print topic


Compiling Multiple Program Modules

Multiple embedded SQL source files, compiled separately and linked to a single executable file, can share the same database connection at run time. This is also true for programs that are compiled into separate dynamic-link libraries (.dll files). If subsequent program modules (in the same process) do not process a CONNECT statement, they share the same database connection with the module that included the CONNECT statement.

OpenESQL
In a program that includes multiple, separately compiled modules, you should compile only one module with the INIT option of the SQL Compiler directive. All other modules in the program should share that first automatic connection or make explicit connections using the CONNECT statement.
OpenESQL - DB2
  • Statement names are local to a particular program module (compilation unit). This means that a statement cannot be prepared in one module and executed in another.
  • Within an application, cursor names should be unique.
COBSQL
With COBSQL, if the INIT directive is specified more than once, second and subsequent uses are ignored.
Previous Topic Next topic Print topic