ODBC supplies a set of connection functions. Which of the following you use depends on how you expect your application to be deployed and used:
SQLConnect, which is the simplest connection function.
SQLConnect takes a data source name, and an optional user ID and password. You might want 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, which connects to a data source using a connection string.
SQLDriverConnect allows the application to use Adaptive Server Enterprise-specific connection information that is external to the data source.
On Linux and Mac platforms, the ASE ODBC Driver supports
only SQL_DRIVER_NOPROMPT.
You can also use SQLDriverConnect to connect without specifying a data source.
For more information, see SQLDriverConnect in the Microsoft ODBC Programmer's Reference.
SQLBrowseConnect, which 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 ASE ODBC Driver.
For more information, see SQLBrowseConnect in the Microsoft ODBC Programmer's Reference.
In general, the examples in this chapter use SQLConnect.
For a complete list of connection parameters that can be used in connection strings, see Chapter 2, “Connecting to a Database.”