ESQL/C connection library functions in a Windows™ environment
To establish an explicit connection (sometimes called
a direct connection),
Informix® ESQL/C supports
the SQL connection statements. For a complete description of the SQL
connection statements, see the Informix® Guide to SQL:
Syntax. Informix®
ESQL/C also
supports the connection library functions that The following table
lists for establishing an explicit connection from a Windows™ environment.
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: Informix®
ESQL/C supports
the connection library functions for compatibility with Version 5.01 Informix®
ESQL/C for Windows™ applications. When you
write new Informix®
ESQL/C applications
for Windows™ environments,
use the SQL connection statements (CONNECT, DISCONNECT, and SET CONNECTION)
instead of the Informix®
ESQL/C connection
library functions.
Informix® ESQL/C uses an internal structure that contains the handle for the connection and other connection information. The Informix® ESQL/C 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 Informix® ESQL/C program, the esql command processor automatically links the Informix® ESQL/C connection functions to your program.