SQLRETURN SQLConnect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSMALLINT NameLength1, SQLCHAR *UserName, SQLSMALLINT NameLength2, SQLCHAR *Authentication, SQLSMALLINT NameLength3);
Le résultat est SQL_SUCCESS en cas de succès.
#include <sqlcli1.h>
static SQLHANDLE hConnexion;
...
if (SQLConnect(hConnexion, "db2_aix", SQL_NTS, "scott", SQL_NTS, "tiger", SQL_NTS)!=SQL_SUCCESS)
{
...
}
...
if (SQLDisconnect(hConnexion)!=SQL_SUCCESS)
{
...
}
...