Help w/ODBC + Access 97 & Web CGI

Benjamin Schollnick junkster at nospam.rochester.rr.com
Tue May 9 16:44:10 EDT 2000


	I'm running into a slight problem here that I'm having difficulty
tracking down.

	I'm running Python v1.52 with Win32 extensions using ODBC to
communicate with a MS Access 97 database.

	I've successfully used both MxODBC & the ODBC with the Win32
extensions....

	Here's the "funny" part.  One of the tables in the database is a
"Users" table, containing, name, password, comments, etc.  

	I can access my user record (Record 0), but if I attempt to login as
any other user, the login is successful, but if I try any comments, 
the CGI
seems to lockup until the process times out from IIS.

	I don't see any obvious problems, with the database, nor the ODBC
code that I am using, in fact, the USER STATUS command I'm issuing 
reads all
the data back from a COOKIE, not from the Database....

	To illustrate:

		- Login (Read / compare data from database)
			|- Writes user record information to a cookie
		- User Status
			|- Reads data from cookie, displays on screen
		- User Edit
			|- Reads account from cookie, displays
				for editing, saves back to database

	I'm using the Cookie module from Timothy O'Malley, v2.25 05/03/2000.

	Has anyone hit a problem like this before?  I tried going through
the archives, but didn't see anything obvious in the web search's that
I
performed.

	Here's the ODBC wrapper, I wrote....Feel free to point out any
problems:

(Keep in mind, this is my first real attempt at ODBC related code.)


import dbi, ODBC     # ODBC modules
import time          # standard time module


def	login_to_homepage ( username='', passwd=''):
	login_string = ''
	database_conn = ODBC.Windows.Connect(     	# open a database 
connection
       			'homepages', username, passwd)  # 'datasource/user/password'
	return database_conn

def	logout_database (database):
	database.close()
	       
def	do_SQL_statement ( sql_statement, database_handle, 
database_description = None ):
	crsr = database_handle.cursor()  		# create a cursor
	crsr.execute (sql_statement)     		# execute some SQL
	database_description = crsr.description
	results = crsr.fetchall()
	crsr.close()
	return results, database_description

def	do_update_statement ( sql_statement, database_handle ):
	crsr = database_handle.cursor()  		# create a cursor
	results = crsr.execute(sql_statement)     	# execute some SQL
	#results = crsr.fetchall()
	crsr.close()
	return results

def	do_insert_into_statement ( sql_statement, data, database_handle ):
	crsr = database_handle.cursor()  		# create a cursor
	results = crsr.execute(sql_statement, data)     	# execute some SQL
	crsr.close()
	return results

====================================================
          (Remove "NoSpam" to Email me)
====================================================
Please feel free to copy any and or all of this sig.
A little something for spam bots:

root at localhost postmaster at localhost admin at localhost
abuse at localhost postmaster at 127.0.0.1

Chairman William Kennard: bkennard at fcc.gov 
Commissioner Susan Ness: sness at fcc.gov
Commissioner Harold Furchtgott-Roth: hfurchtg at fcc.gov
Commissioner Michael Powell: mpowell at fcc.gov
Commissioner Gloria Tristani: gtristan at fcc.gov
consumerline at ftc.gov
fccinfo at fcc.gov
ssegal at fcc.gov




More information about the Python-list mailing list