SQLConnect

Prototypes

SQLRETURN SQLConnect(SQLHDBC ConnectionHandle, SQLCHAR *ServerName, SQLSMALLINT NameLength1, SQLCHAR *UserName, SQLSMALLINT NameLength2, SQLCHAR *Authentication, SQLSMALLINT NameLength3);

Description

Etablit la connexion pour le handle ConnectionHandle avec l'utilisateur UserName de mot de passe Authentification sur le serveur ServerName.

Le résultat est SQL_SUCCESS en cas de succès.

Exemple

#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) ...

Voir aussi

SQLDisconnect pour se déconnecter.