[DB-SIG] Help w/ODBC + Access 2000 / CGI problem?

Schollnick, Benjamin Benjamin.Schollnick@usa.xerox.com
Tue, 09 May 2000 08:02:22 -0400


Folks,

	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 2000 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