pythonwonderware

connect to Wonderware Historian OLE DB using python 3 and OSX or Linux


Could anyone share a functional connection method to Wonderware's Historian using python3 on OSX (or linux)?

Historian is apparently a Microsoft SQL Server OLE DB (see pg102 of http://www.logic-control.com/datasheets/1/Historian/HistorianConcepts.pdf).

Another SO post suggests that the only python library available capable of connecting to an OLE DB is 'adodbapi' (Connecting to Microsoft SQL server using Python)

an attempt in code (using default RO credentials):

import adodbapi
ServerName = "ServerName"
MSQLDatabase = "Runtime"
username = "aaUser"
password = "pwUser"
conn = adodbapi.connect("PROVIDER=INSQL;Data Source={0};Database={1};trusted_connection=yes;UID={2};PWD{3};".format(ServerName,MSQLDatabase,username,password))

That gives an error:

adodbapi.apibase.OperationalError: (InterfaceError("Windows COM Error: Dispatch('ADODB.Connection') failed.",)...

The error is probably due to the absence and unavailability of the pywin32 package, which is apparently Windows only (Pywin32 (com objects) on Mac)

Tips appreciated. I highly suspect that the Microsoft vs Mac/Linux worlds just can't be bridged in this situation.


Solution

  • You should be able to access an MS SQL Server database (e.g. Wonderware Historian database) with Python.

    Things to check: