How to log OPC data to a SQL database
This guide shows how to log OPC UA or OPC DA data into a database in three easy steps. Reading a value from the OPC Data Access server or writing a data value can be achieved without any programming.
- Install the OPC Data Logger software.
- Add an OPC group and the necessary OPC tags.
Fig.1. OPC group settings
Fig.2. OPC DA or OPC UA tag selection
-
Configure the database connector that can work with MS SQL Server, MySQL, Oracle, MS Access, and other databases.
Fig.3. SQL database connector
How to map OPC server data to a SQL database
- Go to the data export plugin settings.
- Import a table description from your SQL database.
Fig.4. SQL database table
- Link an OPC tag to a column in the dialog window.
Fig.4. SQL database mapping
What data types supported
The program support all major data types of OPC DA or OPC UA interfaces:
- Signed and unsigned integers (1, 2, 4, and 8 bytes).
- Float (single and double precision).
- Boolean.
- Strings (UTF8 and ASCII).
- Date and timestamps.
- Other minor data types.
Supported databases
The OPC Data Logger software supports all popular databases.
- Microsoft SQL Server (you can use stored procedures, custom SQL queries, high data transfer speed).
- MySQL (supports stored procedures, custom SQL queries, high performance).
- Oracle (allows using stored procedures, custom SQL queries, high data transfer speed).
- Microsoft Access.
- PostgreSQL (allows using stored procedures, custom SQL queries, high performance).
- Firebird.
- OLEDB-compatible databases.
- ODBC-compatible databases.
Operating System Compatibility
Windows Server 2019, Windows 10, Windows Server 2016, Windows 7, Windows Server 2012, and older operating systems down to Windows XP SP3.
OPC Compatibility
- OPC Data Access 2.05a
- OPC Data Access 2.00
- OPC Data Access 1.0a
- OPC Data Access 3.00
- OPC UA Data Access
Do I need third-party components?
You should install runtime components for OPC DA that provide client access to an OPC server. Please, visit the opcfoundation.org
Microsoft SQL Server - client tools for the SQL Server database. All modern OS already includes database drivers for this database.
MySQL - The computer with the OPC software should contain "libmysql.dll." Usually, it comes with the MySQL database.
Related articles: How to log OPC data to a SQL database
OPC and DCOM Configuration on Windows 2008 and Windows 7
OPC and DCOM Configuration on Windows 10, 11, Windows Server 2019, 2022