Database
Summary
This document details different ways to create connections between ADISRA SmartView and the desired relational database(s).
There are different ways to create a connection between ADISRA SmartView and the databases, so it is important to establish why each connection will be needed and how it is going to be used.
Examples:
- If the user just wants to store tag values in the database, the user will only need to create a global database connection in the top ribbon and use that connection in the Tag History document.
- If the user wants to store the alarm history, it will be a similar solution. The user will need to create a global database connection and use that connection in the Alarm History document.
- If the user needs to execute queries such as “create table”, “select”, “update” or “delete”, the user may use the global database connection and the system function library or the user can write the entire connection using their own script. In this second example, the user will not need the global database connection.
Please review the following sections and feel free to use one of the solutions in an
application.
Configure Global Database Connection
Create new connection
The Global Database Connection is part of the project settings. It allows the user to create a database connection through a connection wizard and use that connection in their application. To configure a new global database connection, please follow the steps below:
- In the ADISRA SmartView ribbon, go to “DataBase Connections” and click the “DataBase Connections” button, the “DataBase Connections” window will open.
- To add a new database connection, click the “+” button shown in the red box below:
- In this example, we will configure a PostgreSQL connection, select PostgreSQL then click OK:
- The “Connection Properties” window will appear, the user should type in the database information that the user wants to connect. The image below is just an example:
- Click the “Test Connection” button, if all the information is correct, it will display the following dialog:
- If the test connection succeeded, please click OK.
- If the test is not successful, then an error message will be displayed with the error description. The error message may state a driver installation is missing or connection information does not match.
- The Advanced button displays custom configurations for the selected database driver. The database being used will determine if the additional information is required.
- Click OK on the “Connection Properties” window, then name the connection and select if the tables will or will not be created with the default suffix. The default suffix is the name of the project:
- If the user wants to change the suffix, uncheck the Default Suffix check box and enter the new suffix:
- See the example of two tables created, the first one with a custom suffix, and the second one with the default suffix which is the name of the project. In this example the project name is “databaseproject”:
- The user should see the connection created:
- Different DataBases will have different options in the “Connection Properties” window. The user should configure it according to the Database configuration.
Remove connection
To remove a database connection, follow the steps below:
- In the ADISRA SmartView ribbon, go to “DataBase Connections” and click the “DataBase Connections” button, the window “DataBase Connections” will open.
- Select the connection the user wants to remove and click the “-” button shown in the red box below.
- Confirm the user wants to remove the connection item.
Edit connection
To edit a database connection, follow the steps below:
- In the ADISRA SmartView ribbon, go to “DataBase Connections” and
click the “DataBase Connections” button. The window “DataBase
Connections” will open.
- Select the connection the user wants to edit and click the “pencil symbol”
button shown in the red box below.
- It will open the “Connection Properties” window so the user can edit the
connection.
Rename connection
To rename a database connection, follow the steps below:
- In the ADISRA SmartView ribbon, go to “DataBase Connections” and click the “DataBase Connections” button. The window “DataBase Connections” will open.
- Select the connection the user wants to rename and click the “Rename Connection” button shown in the red box below.
- The “Rename Connection” window will open and the user can rename the connection. Select “OK” to complete the renaming.
Global Database Connections
The “Global Database Connection” option, highlighted in the red box above, can be used to store Tag Values and Alarms in the database. The option can be used to run queries using the SVDatabase System function Library.
To use the configured global database connections, follow the steps below.