Accessing WINCC OA HDB Using OLE DB Provider

By mayur_nj4bdivn — In WinCC OA — July 12, 2018



*This blog follows from – Leveraging the Cloud for WinCC OA. Please check it out for an introduction to using the Cloud capabilities for WinCC OA. In the last blog, we explained about the advantages of using platforms like Elastic Stack, Web Frameworks, Python etc. with WinCC OA. In this blog, we discuss how to actually access data from WinCC OA to use with an analytics or Big Data platform or database of your choice. We will focus on the data archived in History DB (HDB), and how to pull it using OLE DB Provider. OLE DB Provider has been provided by WINCC OA. OLE DB is a Microsoft specification for accessing data on different computers. It is based on Microsoft’s COM technology and is the successor to the older and limited ODBC technology. While ODBC uses static APIs for data access and is limited to SQL, OLE DB uses ADO (ActiveX Data Objects) to provide a quick and easy facility for programming applications. OLE DB Provider is supposed to give access to the underlying HDB. It uses its own SQL queries to get Data Points. The examples are provided in the Help Documentation provided along with the WinCC OA software. Let’s check out the requirements and limitations for using OLE DB with WinCC OA:

  1. WinCC OA version 2.12.1 or higher should be installed.
  2. It can access only archived Values and Alerts that exist in the History DB.
  3. Data can only be read, not edited.
  4. No direct support for Windows Excel 2000 or earlier versions.
  5. The Data Manager must be running when OLE DB Provider is started. If the Data Manager is stopped, queries using OLE DB are no longer possible.
  6. For distributed Systems, each WinCC OA instance should be running its own OLE DB Driver to provide access to external applications.
  7. Under Windows 64 bit, only single Server Systems are allowed as compared to Distributed systems having multiple Clients.
  8. OLE DB provider is a 32 bit driver, so it might not interact too well with 64-bit applications.
Based on these points, if your requirements are not met, you can refer to – Accessing HDB via Websocket using C# API. If you can work with these requirement, read on. Let’s get started on how to set up OLE DB Access. The following steps can be found in the Help documentation provided in the WinCC OA software too:
Step 1 – Add WinCCOAoledb manager to the WinCC OA Project
Go to your project directory and navigate to the config folder within it. Open the file called progs and add the following line to the end:
windows/WCCOAoledb | manual |      30 |        2 |        2 |
*Make sure there are no blanks in the end.
Step 2 – Register the OLE DB drivers and executable
Open a command prompt as Administrator, and navigate to the WinCC_OA_installation_directory/bin/windows directory. Here, run these 3 commands:
WCCOAoledb.exe /regserver

regsvr32 WCCOAOleDbExeps.dll

regsvr32 WCCOAoledb.dll
Step 3 – Start WCCOAoledb Manager from the console
Now, when you start/restart your project, you’ll see the OLE DB Manager in the console.You can start it directly from the console.
Click for larger image

We have been able to get access using MS Excel as well as a Python Script with WIN32COM library. To find instructions on how to access HDB data using MS Excel, please refer to the help documentation provided with WinCC OA. Moreover, MS Access will also be able to access the underlying Data. An example output using python is shown below:

Click for larger image

To use OLE DB Provider with Python, a 32 bit version of python should be installed, and you should download the win32com library to use the communication client. The win32com client is distributed as a part of pywin32 library, which you can download from here.

If you have any questions, or need help implementing any of the Industrial Automation tools mentioned in this and other Blog posts, please feel free to contact us with any questions at +1-919-800-0044 or e-mail us at Control Infotech, our Industrial Automation partner applies substation automation domain expertise in the realm of utility grid-tie solar generation plants. Complete solutions from Grid-tie engineering, protection & Control panel build, relay programming and PV plant asset monitoring are among the solutions they offer. The SCADA system is technologically the most advanced. It offers user friendly features on a non-proprietary commercially available platform. Customers benefit from a stable and powerful monitoring and control platform that can be seamlessly expanded and deployed on a Cloud platform. Suyash Kanungo, BTech, MS Computer Engineer SAM IT Solutions
Spread the love