Skip to content

Instantly share code, notes, and snippets.

@charlesreid1
Last active March 24, 2023 05:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save charlesreid1/28299e1977c832b163e3 to your computer and use it in GitHub Desktop.
Save charlesreid1/28299e1977c832b163e3 to your computer and use it in GitHub Desktop.
Gist illustrating how to connect to a GE Proficy iHistorian OLEDB instance from Python. This uses the PyADO library (http://pyado.sourceforge.net).
import PyADO
#print help(PyADO.connect)
conn = PyADO.connect(None,host='localhost',user='',password='',provider='iHOLEDB.iHistorian.1')
print conn
curs = conn.cursor()
curs.execute("SELECT * FROM ihTags")
result = curs.fetchall()
descr = curs.description
for col in descr:
print col[0],
print
for row in result:
for col in row:
print col,
print
curs.close()
conn.close()
@kevinding1125
Copy link

hello,I run your code in my computer recently,However,the code get exception:
pywintypes.com_error: (-2147352567, '发生意外。', (0, 'ADODB.Connection', '对象关闭时,不允许操作。', 'C:\WINDOWS\HELP\ADO270.CHM', 1240653, -2146824584), None)

I find all kinds of method for this,but not sovle it.Do you know the problem of it?please help me.thanks for your consideration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment