SQLConnectEx () function
- Last UpdatedJun 17, 2024
- 1 minute read
You use the SQLConnectEx() function in an InTouch QuickScript to connect to the database specified by the ConnectString argument, when using the credentials of type “Username and password” for SQL authentication.
SQLConnectEx() returns a value to the ConnectionID argument that is used as a parameter in all subsequent SQL functions. You must have a Bind List defined in the application folder before using the SQLConnectEx function in a script.
Category
SQL
Syntax
[ResultCode=]SQLConnectEx(ConnectionID, "ConnectString", "Credential Name");
Arguments
ConnectionID
Name of a memory integer tag that holds the number (ID) assigned by the SQLConnectEx() function to each database connection.
ConnectString
String that identifies the database and any additional logon information used in SQLConnectEx() function.
Credential Name
Name of the credential stored in the Credential Manager. For standalone InTouch applications, the credentials are retrieved from the Application Manager. For managed InTouch applications, the credentials are retrieved from the Credential Manager of the Application Server.
Remarks
You must have a Bind List (a SQL.DEF file) in the application folder. This function does not work without it.
If SQLTrace=1 is defined under the [InTouch] section of the win.ini file, each successful execution of SQLConnectEx logs version information for the ADO, the provider, and the database system to the Log Viewer.
Examples
The following statements connects to IBM OS/2 Database Manager and to the database named SAMPLE:
[ResultCode=]SQLConnectEx(ConnectionID,"DSN=OS2DM;
DB=SAMPLE");
This function returns a value to the ConnectionID variable that is used as a parameter in all subsequent SQL Functions.
"DSN=data source name[;attribute=value
[;attribute=value]...]"