Establish a connection for your application, before it can carry out any database operations.
You can find a complete sample of establishing a connection in your installation directory.
Notes on Usage
Every string passed to ODBC has a corresponding length. If the length is unknown, you can pass SQL_NTS indicating that it is a Null Terminated String whose end is marked by the null character (\0).
Use the SQLSetConnectAttr function to control details of the connection. For example, this statement turns off ODBC autocommit behavior:
retcode = SQLSetConnectAttr( dbc, SQL_AUTOCOMMIT, (SQLPOINTER)SQL_AUTOCOMMIT_OFF, SQL_IS_UINTEGER );
Many aspects of the connection can be controlled through the connection parameters.
For more information including a list of connection attributes, see SQLSetConnectAttr in the Microsoft ODBC Programmer's Reference.