![]() | ![]() |
Home |
|
|
Access Service User's Guide DirectConnect for AS/400 |
|
| Chapter 5 Understanding the request process |
|
| API calls |
This section describes how the following client API procedure calls interact with the access service on a command-based level:
DB-Library API
ODBC API, if the client is using an ODBC application
CT-Library API
The following examples are for language commands only. For information about specific APIs, see the Open Client Client-Library/C Reference Manual.
The following figure shows the interaction between a DB-Library client application and the access service.
Figure 5-2: DB-Library client API example
The DB-Library API processing flow includes the following steps:
The client application connects to a specific DirectConnect access service using the dbopen call. This initiates a connect event within the server, such as the AS/400. Then, DirectConnect logs on to the AS/400 server, using the specified user ID and password.
The application builds and executes a SQL request using the dbcmd and dbsqlexec calls. The access service receives the SQL request as a language event, transforms datatypes (if needed), and passes the request on to the AS/400.
To prepare for the resulting data, the application assigns local variables to specific columns using the dbbind call. The dbnextrow call retrieves the resulting data (the results of the processed request made by the client) and returns the data to the application.
The client application terminates database processing using a dbclose call. This initiates a disconnect event in the DirectConnect server.
Procedure calls for the DB-Library API are explained in the Microsoft SQL Server Programmers Reference and the Sybase Open Client DB-Library/C Reference Manual.
For information about accessing database catalog information with applications that use CSPs, see Chapter 12, "Accessing catalog information with CSPs"
Sybase provides an ODBC Driver that allows ODBC applications to access the AS/400 through DirectConnect.
The following figure shows the interaction between an ODBC client application and DirectConnect.
Figure 5-3: ODBC client API example
The ODBC API processing flow includes the following steps:
Using the SQLConnect call, the ODBC client application initiates a connect event to a specific access service in DirectConnect. The ODBC driver uses the CT-Library API.
The ODBC application builds and executes the request using the SQLExecute function, initiating a language event in DirectConnect.
The ODBC API uses SQLBindCol to assign local variables to specific columns. The SQLFetch call then returns the resulting data to the application.
The ODBC API terminates the request with a SQLDisconnect call, initiating a disconnect event.
Procedure calls for the ODBC API are described in the Microsoft ODBC Programmer's Reference and SDK Guide.
The following figure shows the interaction between a Sybase Open Client CT-Library API and DirectConnect.
Figure 5-4: CT-Library client API example
The CT-Library client API processing flow includes the following steps:
When a CT-Library application issues a request, it uses the ct_connect call to initiate a connect event to a specific access service.
Using the ct_command and ct_send calls, the CT-Library API executes the request, initiating a language event in DirectConnect.
The CT-Library API uses ct_fetch to return the requested results to the client application.
The CT-Library API terminates the request with the ct_close call, initiating a disconnect event.
Procedure calls for the CT-Library API are described in the Sybase Open Client Client-Library/C Reference Manual.
|
|