Dataset DBs (Reference) define database connections for data storage, retrieval, and manipulation within the FrameworX platform. It provides:
Each DB represents a connection to a database used for tags, alarms, historian, or custom data operations.
Configuration Properties
| Property | Description | Required |
|---|---|---|
| Name | Unique database identifier | Yes |
| Provider | Database technology (SQLite, SqlClient, etc.) | Yes |
| Database | Database type/instance | Yes |
| ConnectionString | Connection parameters | Yes |
| LogonPassword | Authentication password (admin only) | No |
| GatewayIP | Remote gateway for security (former ServerIP) | No |
| FilterColumns | Query optimization columns | No |
| CustomOptions | Additional configuration | No |
| Description | Documentation text | No |
Four system databases are included in every solution:
| DB Name | Purpose | Default Location |
|---|---|---|
| Retentive | Stores retentive tag values | <SolutionNameAndPath>.dbRetentive |
| RuntimeUsers | Dynamic user management | <SolutionNameAndPath>.dbRuntimeUsers |
| AlarmHistorian | Alarm and audit trail records | <SolutionNameAndPath>.dbAlarmHistorian |
| TagHistorian | Time-series data storage | <SolutionNameAndPath>.dbTagHistorian |
Provider=<provider>;Data Source=<source>;Additional ParametersSQLite (Local):
Provider=System.Data.SQLite;
Data Source=_SolutionPathAndName_.dbSQL Server Express:
DataSource=.\SQLEXPRESS;
Initial Catalog=myDatabase;
User Id=sa;Password=pwdPostgreSQL:
Host=localhost;Database=mydb;
Username=user;Password=pass;Port=5432Use these macros for portable configurations:
| Macro | Description | Example |
|---|---|---|
_SolutionPath_ | Solution directory | C:\Solutions\MyApp\ |
_SolutionName_ | Solution name only | MyApp |
_SolutionPathAndName_ | Full path with name | C:\Solutions\MyApp\MyApp |
_ExecutionPath_ | Working directory | Current runtime folder |
_ExecutionPathAndName_ | Working path with name | Runtime location |
_ProductPath_ | Installation directory | C:\Program Files\FrameworX\ |
_Exchange_ | Default transfer folder | Public\Documents\Exchange\ |
_ThirdParty_ | Third-party components | MyDocuments\ProductName\ThirdParty\ |
| Provider | Supported Databases |
|---|---|
| System.Data.SQLite | SQLite |
| System.Data.SqlClient | SQL Server, SQL Server Express |
| Npgsql | PostgreSQL |
| MySql.Data.MySqlClient | MySQL |
| Oracle.DataAccess.Client | Oracle |
| System.Data.Odbc | Any ODBC-compatible |
| System.Data.OleDb | Access, Excel, CSV |
| MongoDB.Driver | MongoDB document database. Accepts JSON directives, aggregation pipelines, and a SQL-subset dialect. See MongoDB Database Connector (DRAFT v10.1.5). |
| Database | Syntax Example | Special Considerations |
|---|---|---|
| SQL Server | SELECT TOP 10 * FROM Table | Use TOP for limiting |
| SQLite | SELECT * FROM Table LIMIT 10 | Use LIMIT clause |
| MySQL | SELECT * FROM \Table` LIMIT 10` | Backticks for names |
| PostgreSQL | SELECT * FROM "Table" LIMIT 10 | Case-sensitive names |
| Oracle | SELECT * FROM Table WHERE ROWNUM <= 10 | ROWNUM for limiting |
| MongoDB | SELECT * FROM collection LIMIT 10 | Document database. SQL subset translates to MongoDB find. Field names are case-sensitive. JSON directives and aggregation pipelines also accepted in the same Command Text field. |
Dataset query authors can declare bind parameters inline by prefixing the Command Text with a PARAMS block. The runtime parses the block, registers each parameter with the underlying ADO.NET command, and substitutes values at execution time — values never become part of the SQL string and are not subject to SQL-injection vectors.
PARAMS @p0='value1', @p1=123, @[email protected];
SELECT * FROM MyTable WHERE Name = @p0 AND Qty > @p1Rules:
PARAMS must be the first token; consecutive parameter assignments are separated by a comma (,), and the block is terminated by a single semicolon (;) that separates it from the SQL body. A newline does not end the block.@ and follow the host database's identifier rules (e.g. @p0, @customerId).@Tag.<name>) resolved at execution time.PARAMS to keep the value out of the SQL string.String concatenation ("SELECT * FROM T WHERE Name = '" + userInput + "'") is acceptable only when every concatenated fragment is a trusted, code-controlled constant. Any user-, tag-, or network-sourced value MUST go through PARAMS. The PARAMS path also avoids quote-escaping bugs and DateTime locale ambiguity that concatenation invites.
// Preferred: feed values as tag references so PARAMS never sees the raw string.
@Tag.FilterName = filterName; // filterName came from a Display input
@Tag.FilterMinQty = filterMinQty;
@Dataset.Query.SelectCommand.SqlStatement =
"PARAMS @[email protected], @[email protected];\n" +
"SELECT Id, Name, Qty FROM Products WHERE Name = @name AND Qty >= @minQty";
@Dataset.Query.SelectCommand.Execute();
// The raw input never enters the SQL string; even a malformed input
// (with quotes, semicolons, or comment tokens) cannot break the parse. |
For concurrent operations to same database:
DB1 → Production Database (Thread 1)
DB2 → Production Database (Thread 2)
DB3 → Production Database (Thread 3)Create multiple DB connections to same database for parallelism.
Default Behavior:
Configuring External Databases:
DateTimeMode Settings:
- UTC: No conversion needed
- LocalTime: Platform converts automatically
- Custom: Handle in SQL statementsLocal Time Queries:
sql
-- Adjust for local time zone (example: EST -5 hours)
WHERE Timestamp >= DATEADD(hour, -5, @Tag.StartTimeUTC)Automatic database switching for development:
| Production DB | Development Override |
|---|---|
<name>.dbRetentive | <name>.dbRetentiveDev |
<name>.dbRuntimeUsers | <name>.dbRuntimeUsersDev |
<name>.dbAlarmHistorian | <name>.dbAlarmHistorianDev |
<name>.dbTagHistorian | <name>.dbTagHistorianDev |
Configure GatewayIP for gateway security:
Gateway Configuration for Restricted Databases:
Benefits:
Built-in tool for SQLite management:
Interactive SQL query creation:
The Store & Forward feature has specific requirements:
For Store & Forward configuration, see Historian Archiving Process documentation.
Connection failed:
Access denied:
Performance issues: