Page Tree
Software Knowledgebases
This chapter explains how to setup your database in FactoryStudio, using the built-in internal database or connecting to an existing external database.
External databases can be configured on the same server that is running the project as on different servers, using remote configuration.
Different providers can be used (SQL Server, Oracle, SQLite, PostgreSQL, and others...), and configured simple and fast.
On this page: |
---|
By default, FactoryStudio uses an embedded SQL database (TatsoftDB) for the tag and alarm historians. You can configure external databases such as Microsoft SQL Server, Oracle, or others. If you expect your database to grow to more than 10 GB, you should consider using an external database.
When using the embedded database, the system automatically creates the database file. When using external databases, the database itself must already exist. However, FactoryStudio can create the tables in the database.
You can also use external databases as a data source in your application to display such things as customer or product information or to configure systems from recipes.
You must be logged in as Administrator in FactoryStudio to configure the database login and password.
To configure an external database:
Enter or select information, as needed.
Column | Description |
Name | Enter a name for the database configuration. The system lets you know if the name is not valid. |
Provider | Select the database provider. |
Database | If options display here, select the database type. |
ConnectionString | Enter the information needed to connect to the database. |
LogonName | Enter a valid login name for the database. |
LogonPassword | Enter the password that corresponds to the database login. |
ServerIP | Enter the IP of the server of the database |
Description | Enter a description for the database. |
[Other columns] | For definitions of other columns that are available in many tables, see "Common Column Definitions". |
The databases you create are available for use on the Tags > Historian tab, in displays, and in scripts.
Historian and Alarms Connection String
The connection string for TagHistorian and AlarmHistorian has some parameters that can be configured to avoid data loss. They are:
You can connect to Excel databases using an ODBC driver, an ODBC DSN, or OleDB.
Using ODBC
Select, then name a range of rows and columns in the worksheet. This will allow the software to read the information as a table. Choose one of the following naming processes for your version of Microsoft Excel:
For Microsoft Office 2007:
Right-click the selection then choose "Name a Range".
For Microsoft Office 2003:
In Microsoft Excel go to "Insert > Name > Define".
Name the selection (e.g., "itemsTable"). The Excel file is now ready for use.
There are several methods for communicating using ODBC:
Using ODBC Microsoft Excel Driver
Note: "Test" is optional.
Using ODBC with a DSN
Using OleDB
If you are using an external database as a data source in your application, you can specify which table to use from the database.
To configure database tables:
Enter or select information, as needed.
Column | Description |
Name | Enter a name for the table configuration. The system lets you know if the name is not valid. |
DB | Select the database configuration. |
TableName | Select the table name. |
WhereCondition | Specify parameters to filter the data using SQL syntax. E.g. "ColumnName = {@tag.tagInt}" |
Access | Select the access permissions for the table. |
Mapping | Click ... to select the tags that you want to populate with data from the first row of the table with data from specific columns. |
MappingDateTime | Select the time reference: UTC or Local. |
Description | Enter a description for the table configuration. |
[Other columns] | For definitions of other columns that are available in this table, see "Common Column Definitions". |
Reading and writing the table contents
Runtime access to the table contents is executed automatically when the table is mapped to a DataGrid object. See "Configuring a DataGrid Window". You can also get the table contents or perform operations on the tables, using the runtime properties for the Dataset table object. See http://www.tatsoft.com/help/fs-2014/runtime/index.html.
You can configure queries to perform more advanced functions with SQL statements to work with data from external databases.
To configure database queries:
Enter or select information, as needed.
Column | Description |
Name | Enter a name for the query. The system lets you know if the name is not valid. |
DB | Select the database configuration. |
SqlStatement | Enter the query using SQL syntax. |
Mapping | Click ... to select the tags that you want to populate with data from specific columns returned by the query. |
MappingDateTime | Select the time reference: UTC or Local. |
Description | Enter a description for the table configuration. |
[Other columns] | For definitions of other columns that are available in this table, see "Common Column Definitions". |
Getting the query contents
Runtime access to the table contents is executed automatically when the query is mapped to a DataGrid object. See "Configuring a DataGrid Window".
You can also get the query contents or perform operations on the query, using the runtime properties for the Dataset.Query object. See http://www.tatsoft.com/help/fs-2018/runtime/index.html.
You can configure files to retrieve data from a network location.
To configure database files:
Enter or select information, as needed.
Column | Description |
Name | Enter a name for the file configuration. The system lets you know if the name is not valid. |
FileName | Enter the full path to the file. |
FileType | Select the type of file. |
Objects | Click ... to select the tags that you want to populate with data from the file with data from specific columns. |
Description | Enter a description for the file configuration. |
XMLSchemaType | Represents the schema type of an XML file, which can be: TagList: XML containing a tag list with tag name and tag value TagObject: XML containing the entire tag tree and its children |
[Other columns] | For definitions of other columns that are available in this table, see "Common Column Definitions". |
The namespace Dataset is the entry point to all objects related with the Datasets module.
The Dataset.DB object lists all configured database connections and its runtime properties
The Dataset.Table object lists all configured tables and their runtime properties
The Dataset.Query object lists the defined queries and their runtime properties.
The Dataset.File object lists the defined queries and their runtime properties.
See "Namespaces" for the complete programming reference on runtime objects.