Sample python database connection via ODBC
First, download and install the pyodbc module. I needed to additionally install the packages for g++ and python-dev on my debian box.
The install was simple:
python setup.py build python setup.py install
Test the install with the following simple query against the e-MD’s database:
import pyodbc
c = pyodbc.connect('DSN=TOPSDATA;UID=emds;PWD=******')
cursor = c.cursor()
cursor.execute("select * from VIEW_Physician")
while (1):
row = cursor.fetchone()
if row == None:
break
print row
cursor.close()
c.close()