Connecting with f90SQLConnect

 

f90SQLConnect is the simplest connection subroutine. It requires a data source name and accepts an optional user ID and password. It works well for applications that hard-code a data source name and do not require a user ID or password. It also works well for applications that want to control their own "look and feel," or that have no user interface. Such applications can build a list of data sources using f90SQLDataSources, prompt the user for data source, user ID, and password, and then call f90SQLConnect.

 

A typical call to f90SQLConnect is done as follows:

 

call f90SQLConnect (ConnectionHandle, ServerName, UserName, Authentication, Ret)

 

where, ConnectionHandle is a connection handle, ServerName is the name of a DSN (Data Source Name), UserName is a user ID and Authentication is the user password. If f90SQLConnect succeeds in establishing a connection to the data source, it will return the values SQL_SUCCESS or SQL_SUCCESS_WITH_INFO in parameter iRet. The code in Example 4.4 and Example 4.6 show how to use f90SQLConnect to open a connection.