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