For connecting a data base with atvise®, follow the next steps:
- Download and install the appropriate driver for your database, such as "MySQL ODBC 8.0 ANSI Driver".
- Create a new data source connection in the System DSN section of ODBC (32-bit or 64-bit) based on the architecture of atvise® SCADA.
- Follow the instructions specific to the driver you are setting up for the data source.
- Take note of the connection name, as it will be required for the script in atvise®.
- Open atvise® Live in the builder and navigate to the Scripting section. Click on the Download button and select "Import" for the "i026 ODBC example".
- Go to the "Menu Script" section. The following menu scripts will be created: Library > Project > Menu Scripts > ODBC.
- Modify the line odbcClient.source = "DSN=ODBC_Name; Uid=NameOfUid; Pwd=password;"; . Change the name of the ODBC connection accordingly.
- Alternatively, you can simplify the code by using odbcClient.source = "DSN=ODBC_Name;"; . In this case, the Uid and Pwd are not required since the ODBC connection already contains the credentials for authentication.
- Modify the odbcClient.query to match the query you want to execute. Simply copy and paste the query from your database and click on the "Save and Run" button. Note that in this step, you do not need to specify the database.table in the query since the database was already selected in the ODBC connection.
- The result will be displayed in the Server Log if you use a query "SELECT" using console.log(query);
Note that these steps are general guidelines, and you may need to adapt them based on your specific database and atvise® configuration.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article