Choosing an ODBC connection function

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 want to use SQLConnect if you hard-code a data source name into your application.

    For more information, see [external link] SQLConnect in the Microsoft ODBC Programmer's Reference.

  • SQLDriverConnect   Connects to a data source using a connection string.

    SQLDriverConnect allows the application to use SQL Anywhere-specific connection information that is external to the data source. Also, you can use SQLDriverConnect to request that the SQL Anywhere driver prompt for connection information.

    SQLDriverConnect can also be used to connect without specifying a data source.

    For more information, see [external link] 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 windows to prompt for connection information and to browse for data sources used by a particular driver (in this case the SQL Anywhere driver).

    For more information, see [external link] SQLBrowseConnect in the Microsoft ODBC Programmer's Reference.

For a complete list of connection parameters that can be used in connection strings, see Connection parameters.


Establishing a connection