INFORMIX
Informix Guide to GLS Functionality
Chapter 7: General SQL API Features
Home Contents Index Master Index New Book

Establishing a Database Connection

To connect to a database, an ESQL client application requests a connection from the database server. The database server must verify that it can access the database and establish the connection between the client and the database. Your client application performs the following tasks:

    The ESQL program performs this step automatically when it requests a connection.

    You must provide code in your ESQL program to perform this step.

Sending Client-Locale Information

When an ESQL client program requests a connection to a database, it sends its client-locale information to the database server. The database server uses this information to determine the following information:

For information on the subset of client-locale information that the client program sends, see "Sending the Client Locale".

Checking for Connection Warnings

The ESQL client application sends the value of its database locale (DB_LOCALE) to the database server. The database server must verify that this database is compatible with the database locale in the system catalog of the database that the client application wants to open.

If this comparison fails, the database server sets the SQLWARN7 warning flag in the SQLCA structure and uses the database locale in the database system catalog. An ESQL client application can check for this warning as follows:

If the sqlwarn7 field has a value of W, the database server has ignored the database locale that the client specified and has instead used the locale in the database as the database locale.

Warning: If the database server generates a warning when it establishes the connection, your application should check the SQLCA structure for warnings after a connection. If you proceed with such a connection, it is your responsibility to understand the format of the data that is being exchanged.
For more information on the comparisons, see "Verifying the Database Locale". For more information on how to handle exceptions within an ESQL program, see Chapter 8 of the INFORMIX-ESQL/C Programmer's Manual or Chapter 4 of the INFORMIX-ESQL/COBOL Programmer's Manual.




Informix Guide to GLS Functionality, version 9.1
Copyright © 1998, Informix Software, Inc. All rights reserved.