[FRPythoneers] Python to the rescue!

Evelyn Mitchell efm at tummy.com
Fri May 18 14:59:01 MDT 2001

I don't use Windows very often, and I don't have much Windows
software (I dislike paying the Microsoft tax, and I don't have
to use their tools if there is an alternative like StarOffice).

Today, one of our clients was trying to connect to a postgreSQL
database we had installed on a Linux server, using ODBC from Win98.
They were testing using the ODBC built into Excel. I don't own
a copy of Excel, and didn't want to buy a copy for this. 

So, Sean suggested that I use the ODBC connection built into
Python for Win32 to test that everything was installed correctly. 

I was using the 

After downloading Python 2.1 for Win32:

and win32all.exe from ActiveState:

I was able to write a test program to confirm the database/odbc 
driver chain was working correctly:

import odbc, dbi
   s = odbc.odbc('DSN/uname/pw')
   cur = s.cursor()
   c = cur.execute('select * from pg_tables')
   while 1:
      rec = cur.fetchmany(10)
      if not rec: break
      print rec
except NameError, e:
   print 'error ', e, 'undefined'

It was the first time I had used Pythonwin, and I was quite 
impressed with how nice it is as an IDE. (Not impressed enough
to give up Linux though!).

Evelyn Mitchell
efm at tummy.com

More information about the FRPythoneers mailing list