short InitializeServer(BSTR ServerName, BSTR UserID, BSTR Password, BOOLEAN ForceDialog, [VARIANT Account], [VARIANT SuppressDialog], [VARIANT CatalogServerUserID], [VARIANT CatalogServerPassword], [VARIANT CatalogServerAccount])
Description
This function initializes a connection to a database server. Call this function prior to calling any other function in the QMF for Windows API. You can call this function multiple times. However, if you call this function and do not end it by calling Commit() or Rollback() an implicit rollback results.
Parameters
Name | Description |
---|---|
ServerName | A string containing the name of the database server that you want to use. This name should match one of the names defined in the QMF for Windows server definition file (SDF). Use the GetServerList() function to retrieve a list of valid servers. |
UserID | A string containing the user ID that you want to use. If this parameter is omitted or is an empty string, QMF for Windows will use the user ID remembered for the server, if available. Otherwise, QMF for Windows will display the Set User Information dialog box to prompt for a user ID, password, and account. |
Password | A string containing the password for the specified user ID. If this parameter is omitted or is an empty string, QMF for Windows will use the password remembered for the server, if available. Otherwise, QMF for Windows will display the Set User Information dialog box to prompt for a user ID, password, and account. |
ForceDialog | A non-zero value causes QMF for Windows to display the Set User Information dialog box regardless of whether a user ID and password are already available (either remembered for the server or specified on this function call). This allows the user to confirm the information before it is used. A zero indicates that QMF for Windows should display the Set User Information dialog box only if necessary. |
Account | Optionally, a string specifying accounting information to pass to the server when connecting. The server may use this information in a job accounting system. |
SuppressDialog | Optionally, a non-zero value causes QMF for Windows to never display the Set User Information dialog box, even if a user ID and password have not been specified. In this case, an error is returned indicating that no UserID and password were specified. This option is useful when executing in an environment where no user is present to respond to the Set User Information dialog box, for example, on a web server. |
CatalogServerUserID | A string containing the user ID that you want to use to connect to the catalog server for the specified server. This parameter is not used if the specified server is not defined to use a different catalog server. Otherwise, if this parameter is omitted or is an empty string, QMF for Windows will use the user ID remembered for the catalog server, if available. Otherwise, QMF for Windows will display the Set User Information dialog box to prompt for a user ID, password, and account. |
CatalogServerPassword | A string containing the password for the specified catalog server user ID. This parameter is not used if the specified server is not defined to use a different catalog server. Otherwise, if this parameter is omitted or is an empty string, QMF for Windows will use the password remembered for the catalog server, if available. Otherwise, QMF for Windows will display the Set User Information dialog box to prompt for a user ID, password, and account. |
CatalogServerAccount | Optionally, a string specifying accounting information to pass to the catalog server when connecting. The catalog server may use this information in a job accounting system. |
Return Value
The return value will be zero if successful or non-zero if unsuccessful. If the return value is non-zero, you can call GetLastErrorString(), GetLastErrorType(), GetLastSQLCode(), GetLastSQLError(), or GetLastSQLState() to get additional error information.
Related Tasks