How to connect to ActianZen DB located on Windows server from RaspberryPI?

Again thanks to ActianCommunity, finally I found simple solution described here:

https://www.codeproject.com/Articles/4113942/Embedded-IoT-Databases-with-Actian-Zen-and-Python

to make it working also on Raspbian you have to issue following cmds :

(as zen-svc)

dsnadd -dsn=demo -db=Demodata -host=magda

(as root)

cat /usr/local/actianzen/etc/odbc.ini >> ./odbc.ini
cat /usr/local/actianzen/etc/odbcinst.ini >> ./odbcinst.ini

Install also pyodbc library (as root):

apt-cache search odbc | grep python
apt-get install python-pyodbc

and now using this simple python script:

#!/usr/bin/env python
import pyodbc
dsn="Driver={Pervasive ODBC Interface};ServerName=magda;DBQ=Demodata"
cnxn = pyodbc.connect(dsn)
cursor = cnxn.cursor()
cursor.tables()
rows = cursor.fetchall()
print ("Tables found in DSN=%s :" % dsn)
for row in rows:
    print row.table_name

I can acces my Windows DB and use SQL queries on it!

Remember to create ODBC connection to your ActianZen DB on Windows Server using this:

Dodaj komentarz

Twój adres e-mail nie zostanie opublikowany.