SQLConnect connects to a database and saves information about the connection in the provided connection handle. The handle must be previously allocated using the SQLAllocHandle function.
Syntax:
RETCODE SQLConnect (hConn, dbName, dbNameLen, userName, userNameLen, auth, authLen ) ;
Arguments :
The arguments for SQLConnect are listed in below table.
| Type | |Name | Description |
| SQLHDBC | hConn | Newly allocated connection handle |
| SQLCHAR * | dbName | Name of the database to connect |
| SQLSMALLINT | dbNameLen | Length of the database name |
| SQLCHAR * | username | Name of the database user |
| SQLSMALLINT | userNameLen | Length of the username |
| SQLCHAR* | auth | Database encryption password |
| SQLSMALLINT | authLen | Password length |
Returns:
SQLConnect returns SQL_SUCCESS if it is successful else SQL_ERROR.