ESQL/C connection library functions in a Windows environment

To establish an explicit connection (sometimes called a direct connection), supports the SQL connection statements. For a complete description of the SQL connection statements, see the HCL OneDB™ Guide to SQL: Syntax. also supports the connection library functions that The following table lists for establishing an explicit connection from a Windows™ environment.
Table 1. ESQL/C connection library functions and their sql equivalents
ESQL/C for Windows library function Description SQL equivalent See
GetConnect() Requests an explicit connection and returns a pointer to the connection information CONNECT TO '@dbservername' WITH CONCURRENT TRANSACTION The GetConnect() function (Windows)
SetConnect() Switches the connection to an established (dormant) explicit connection SET CONNECT TO (without the DEFAULT option) The SetConnect() function (Windows)
ReleaseConnect() Closes an established explicit connection DISCONNECT (without the DEFAULT, CURRENT, or ALL options) The ReleaseConnect() function (Windows)
Important: supports the connection library functions for compatibility with Version 5.01 for Windows applications. When you write new applications for Windows environments, use the SQL connection statements (CONNECT, DISCONNECT, and SET CONNECTION) instead of the connection library functions.

uses an internal structure that contains the handle for the connection and other connection information. The connection library functions use the connection handle, together with the information in the internal structure, to pass connection information to and from the application. The application can use the connection handle to identify an explicit connection.

If you use these connection functions to establish explicit connections, keep in mind the following restrictions:
  • If you open a cursor in one module (such as a shared DLL), and then use an explicit connection to use that cursor in another module, you must use a host variable for the name of the cursor when you declare the cursor.
  • Make sure that your application uses the correct connection handle at all times.
Important: If an application uses the wrong connection handle, the application can modify the wrong database without the knowledge of the user.

When you compile your program, the esql command processor automatically links the connection functions to your program.