It is possible to establish a robust and secure connection with a PostgreSQL database using the Tag Historian feature. The steps to achieve this involve renaming databases, creating and testing the PostgreSQL connection, configuring tags and tasks, and writing specific queries for select, insert, update, and delete operations.
On this page:
To configure Postgre using Tag Historian, follow the steps below.
Click Test and ensure the connection with the Postgre Server is working correctly. |
For the purpose of this example we have created objects in other modules of the platform, the following is list presenthing them.
Select Query
@Tag.QuerySelect = @Dataset.Quey.QuerySelect.SelectCommand(); @Info.Trace("Select OK:" + @Tag.QuerySelect); |
Insert Query
int i = @Dataset.Query.QueryInsert.ExecuteCommand(); @Info.Trace("Insert OK:" + i); |
Update Query
int i = @Dataset.Query.QueryUpdate.ExecuteCommand(); @Info.Trace("Update OK:" + i); |
Delete query:
int i = @Dataset.Query.QueryDelete.ExecuteCommand(); @Info.Trace("Delete OK:" + i); |
Now, we can run the project and give some different values to the Tags, thus, within pgAdmin 4 we can see that Table 1 was created with values that were given.
Thus, we trigger tasks through Trigger Tags, all Queries were successfully performed and our Table within Postgre is updated with the Queries we created before.