The client-server architecture of ESQL/C applications

When the program executes an SQL statement, it effectively passes the statement to a database server. The database server receives SQL statements from the database application, parses them, optimizes the approach to data retrieval, retrieves the data from the database, and returns the data and status information to the application.

The program and the database server communicate with each other through an interprocess-communication mechanism. The program is the client process in the dialogue because it requests information from the database server. The database server is the server process because it provides information in response to requests from the client. The division of labor between the client and server processes is advantageous in networks where data might not be on the same computer as the client program that needs it.

When you compile the program, it is automatically equipped to communicate with database servers that are either on the same computer (local) or over a network on other computers (remote). The following figure shows a connection between the application and local database servers.
Figure 1: ESQL/C application that connects to a local database server

begin figure description - This figure is described in the surrounding text. - end figure description
The following figure illustrates the application that connects across a network to a remote database server.
Figure 2: ESQL/C application that connects to a remote database server

begin figure description - This figure is described in the surrounding text. - end figure description
To establish a connection to a database server, your application must take the following actions:
  • Identify database server connections that have been defined for the client-server environment of the application
  • Execute an SQL statement to connect to a database server