usingdatabasebeansforallproducts

This is an old revision of the document!


Database Servers in TransSECS (Devices) and MIStudio/MIX use the same code base and therefore are configured and used in much the same way. Database servers can be used in MIStudio (graphically connecting from data sources to save values in database tables), in scripting (adding scripts to servers in MIStudio or TransSECS, or using the JavaScript bean in MIStudio), and by using the Devices Node (adding a Database Device Server to the Devices node in TransSECS (Devices) or in MIStudio. Examples of each of these are provided in the links below.

For all examples, a Database Connection Manager (DatabaseConnectionManager) is used to connect to the database itself. Some DatabaseConnectionManagers are set up for specific databases (MySQL/MariaDB, HSQLDB, and SQLite) but the generic DatabaseConnectionManager can be configured to use any JDBC database, including Microsoft SQL Server and PostgreSQL. The DatabaseConnectionManager specifies the driver class (the JDBC connection Driver), the url to the database (where the database is located and its name), a login name and a password. The database will need to be installed and set up before the DatabaseConnectionManager can be used to connect to it.

To read data from the database or to write data to the database, there are a variety of database server “beans” which, at a minimum, need to be configured to use a table name and a SQL statement, as well as a pre-configured DatabaseConnectionManager. These beans include DatabaseRawWrite (write one value to the database table), DatabaseRawRead (read one value from the database table), DatabaseArrayRawLookup (read an array of values from the table), DatabaseRowLookup (read an array of values from a single row in the table), and DatabaseRawTableLookup (read a 2D array of values from the database, as a whole table). In addition there is a “historical” database bean which writes a whole row of timestamped data to the table when it is triggered, the TriggeredHistorical bean.

Using the Database Servers in MIStudio Graphically

This shows you some examples of setting up a DatabaseConnectionManager in MIStudio and using it to read and write data to a table in the database.

Using the Database Servers in MIStudio and TransSECS Devices Node

Database Connection Managers can be added to and configured in the Devices Node of TransSECS and MIStudio.

  • usingdatabasebeansforallproducts.1627496098.txt.gz
  • Last modified: 2021/07/28 13:14
  • by wikiadmin