After 14 months of hard work, aggravation beyond description, despair of the blackest shade, and, yes, tears, a watershed event. I, erstwhile DI major, terrible math scholar, and programmer par non-excellence, have accomplished something that I have long dreamed about, talked about, and now, finally, accomplished.
Send in the band, please
I have accessed a database, extracted some data, and reported the results, using Python (nifty programming language). Just now, I literally dance for joy. The wife is stunned.
Herewith the details…..
The Code:
# Assign71JAI.py
# A program to access the MaryRichards database, retrieve
# the tuples for the JOBS table, display as output the JOB id, job description
# and amount billed for the job.import pyodbc
try:
cnxn=pyodbc.connect(“DSN=MaryRichardsBackup;UID=The Tortoise;PWD=lucky7″)except pyodbc.Error, error:
print “Error — No access”
else:
print “Connected”
cursor = cnxn.cursor()# Select some values from the database and print them:
cursor.execute(“select * from job”)
allrecs = cursor.fetchall()
for row in allrecs:
print row.JOB_ID, row.Description, row.AmountBilledcnxn.close()
The Result:
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32
Type “copyright”, “credits” or “license()” for more information.****************************************************************
Personal firewall software may warn about the connection IDLE
makes to its subprocess using this computer’s internal loopback
interface. This connection is not visible on any external
interface and no data is sent to or received from the Internet.
****************************************************************IDLE 1.2.1
>>> ================================ RESTART ================================
>>>
Connected
1 Paint exterior in 794 White 2750.0000
2 Paint dining room and kitchen 1778.0000
3 Prep and paint upstairs bath 550.0000
4 Paint exterior doors in 633 Red 885.0000
5 Prep and paint interior wood trim 1299.0000
>>>
I Exult………

Congratulations! As you know, I’m not kidding when I express my envy and admiration for this feat.