Skip to content

Latest commit

 

History

History
92 lines (67 loc) · 2.05 KB

SQLConnect.md

File metadata and controls

92 lines (67 loc) · 2.05 KB

Home

Function name : SQLConnect

Group: ODBC API - Library: odbc32


SQLConnect establishes connections to a driver and a data source.


Code examples:

Testing an ODBC connection for supporting specific functionality
Using vendor-neutral SQL constructs
Retrieveing general information about the driver and data source associated with an ODBC connection
Establishing connection using the SQLDriverConnect
Obtaining list of tables stored in an ODBC Data Source

Declaration:

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

FoxPro declaration:

DECLARE SHORT SQLConnect IN odbc32 AS SQLConnect32;
	INTEGER ConnectionHandle,;
	STRING  ServerName,;
	INTEGER NameLength1,;
	STRING  UserName,;
	INTEGER NameLength2,;
	STRING  Authentication,;
	INTEGER NameLength3
  

Parameters:

ConnectionHandle [Input] Connection handle.

ServerName [Input] Data source name.

NameLength1 [Input] Length of *ServerName.

UserName [Input] User identifier.

NameLength2 [Input] Length of *UserName.

Authentication [Input] Authentication string (typically the password).

NameLength3 [Input] Length of *Authentication.


Return value:

SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.


Comments:

SQLAllocHandle with a HandleType of SQL_HANDLE_DBC is called to allocate a connection.

When the application calls SQLDisconnect to disconnect, the connection is returned to the connection pool and is available for reuse.

I guess I should not explain why this function is declared with an alias.