Use these handle types to establish an ODBC connection.
The header file contains a type definition for a far pointer:
typedef void far * HENV
SQLRETURN rc; HENV henv; rc = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
Dim henv As long SQLAllocEnv(henv)
HDBC hdbc; rc = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);
Dim hdbc As long SQLAllocConnect(henv,hdbc)
rc = SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER) SQL_OV_ODBC3, SQL_IS_UINTEGER);
In C, this statement is coded:
SQLCHAR source[ ] = "myDSN"; SQLCHAR uid[ ] = "myUID"; SQLCHAR pwd[ ] = "myPWD"; rc = SQLConnect(hdbc, source, SQL_NTS, uid, SQL_NTS, pwd, SQL_NTS);