ODBC_SQLConnect

4D - Documentation   Français   English   German   4D ODBC PRO, Command Theme List   4D ODBC PRO, Command Alphabetical List   Back   Previous   Next

version 2004


ODBC_SQLConnect (connectionID; serverName; userName; password) Longint

ParameterTypeDescription
connectionIDLongintConnection ID
serverNameStringData source name
userNameStringUser identifier
passwordStringUser password
Function resultLongintReturns the result of the MS ODBC API function
SQLConnect

Description

The ODBC_SQLConnect function establishes a connection to a specific driver by passing it the serverName, userName, and password. It internally uses the MS ODBC API function SQLConnect.

connectionID is a valid connection ID returned by ODBC_SQLAllocConnect.

serverName is the name of the data source name.

userName is the user name or login name defined when setting up ODBC authorization.

password is the user password.

For more information, please see the SQLConnect function in the MS ODBC API at http://msdn.microsoft.com/library/en-us/odbc/htm/odbcsqlconnect.asp.

Function Results

SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.

Example

The following method connects you to a data source whose name, username, and password are passed to the ODBC_SQLConnect command:

   $result:=ODBC_SQLAllocConnect ($connectionID)
   $result:=ODBC_SQLConnect ($connectionID;"access";"Administrator";"admin1")
   If ($result=SQL_SUCCESS)   `Connection was successful
      `... continue by calling other commands that require a valid $connectionID
   End if

See Also

ODBC_SQLDisconnect.


4D - Documentation   Français   English   German   4D ODBC PRO, Command Theme List   4D ODBC PRO, Command Alphabetical List   Back   Previous   Next