ASA Programming Guide
ODBC Programming
Connecting to a data source
ODBC supplies a set of connection functions. Which one you use depends on how you expect your application to be deployed and used:
SQLConnect The simplest connection function.
SQLConnect takes a data source name and optional user ID and password. You may wish to use SQLConnect if you hard-code a data source name into your application.
For more information, see SQLConnect in the Microsoft ODBC Programmer's Reference.
SQLDriverConnect Connects to a data source using a connection string.
SQLDriverConnect allows the application to use Adaptive Server Anywhere-specific connection information that is external to the data source. Also, you can use SQLDriverConnect to request that the Adaptive Server Anywhere driver prompt for connection information.
SQLDriverConnect can also be used to connect without specifying a data source.
For more information, see SQLDriverConnect in the Microsoft ODBC Programmer's Reference.
SQLBrowseConnect Connects to a data source using a connection string, like SQLDriverConnect.
SQLBrowseConnect allows your application to build its own dialog boxes to prompt for connection information and to browse for data sources used by a particular driver (in this case the Adaptive Server Anywhere driver).
For more information, see SQLBrowseConnect in the Microsoft ODBC Programmer's Reference.
The examples in this chapter mainly use SQLDriverConnect.
For a complete list of connection parameters that can be used in connection strings, see Connection parameters.