Connect QueryPad to a Database
Before you can use QueryPad to test a query, you need to connect it to the appropriate system (the system that contains the tables that you reference in your query). QueryPad can connect to 1 system at a time.
To connect QueryPad to the appropriate database, you can either:
- Use the Connect to Database option from the Query Menu or the Connect to Database button from theQueryPad Toolbar.
- The Connect dialog box is displayed.
- Use the System combo box to choose the required system (database)
- Use the User field to define the name of the user account that is to be used. If the Guest user account is to be used, leave the User field empty.
- Enter the password for the selected user account in the User field (or leave the User field empty if the Guest user account is to be used for the connection)
- Select the OK button.
If the connection is valid, the Information Pane will display:
Connecting to <system name>...
Connected OKIf the connection fails, a diagnostic message detailing the reason for the failure is shown. For example, if you attempt to log on via a user account that does not exist, the error message will be:
*** LogOn failed - Access is denied. ***
- Use an SQL Query. The Connect dialog box is displayed if you try to run an SQL Query in QueryPad and QueryPad is not currently connected to a system. (You can also display the Connect dialog box by entering ?CONNECT without any parameters, then pressing a CTRL key and the Enter key at the same time.
Enter your SQL Query in the Display QueryPad, then press a CTRL key and the Enter key at the same time or use the Execute Query option from the Query Menu or Execute Query button from the QueryPad Toolbar, to execute the command.
If QueryPad is not already connected to a system, the Connect dialog box (shown above) is displayed.
- Use a QueryPad command to connect to a system:
- Display QueryPad
- In the SQL Entry Pane, enter the following:
?Connect <system name> <username> <password>
Where:
- ?Connect is the command to connect to a database
- <system name> is the name of the database to which you want QueryPad to connect. Do not include the angle brackets < >.
- <username> and <password> are the user name and password for a ClearSCADA user account. If you have a username but do not use a password with that account, just enter the username and ignore the <password> part of the command. Do not include the angle brackets < >.
- Your entry is case sensitive.
Example:
The following command would connect QueryPad to a database named Main via the ‘MNoble’ user account which uses the password ‘SE661’:
?Connect Main MNoble SE661
NOTE: If you omit the username and password, QueryPad will connect via the Guest user account for the selected database.
- When you have entered the appropriate command, press a CTRL key and the Enter key at the same time to execute the command (see Run your Query in QueryPad).