Database Access using pyodbc. I've a problem

Rajendran rajenpn at gmail.com
Sat Jun 16 08:35:23 EDT 2007


Hi all,

I've installed pyodbc module to access my database (MS Access). I've
setup a User level DSN to the database.mdb file. When I run my python
code in the command prompt it is retrieving the database contents and
displaying it (HTML output).
But when I run that python from webserver (http://localhost/cgi-bin/
database.py) there comes an  entry in the error log of Apache server
that says:

[Sat Jun 16 17:55:57 2007] [error] [client 127.0.0.1] Premature end of
script headers: database.py
[Sat Jun 16 17:55:57 2007] [error] [client 127.0.0.1] Traceback (most
recent call last):\r
[Sat Jun 16 17:55:57 2007] [error] [client 127.0.0.1]   File "C:/
Apache Software Foundation/Apache2.2/cgi-bin/database.py", line 10, in
<module>\r
[Sat Jun 16 17:55:57 2007] [error] [client 127.0.0.1]     cnxn =
pyodbc.connect('DSN=Emp')\r
[Sat Jun 16 17:55:57 2007] [error] [client 127.0.0.1] pyodbc.Error:
('HY000', "[HY000] [Microsoft][ODBC Microsoft Access Driver] The
Microsoft Jet database engine cannot open the file '(unknown)'.  It is
already opened exclusively by another user, or you need permission to
view its data. (-1032); [HY000] [Microsoft][ODBC Microsoft Access
Driver] The Microsoft Jet database engine cannot open the file
'(unknown)'.  It is already opened exclusively by another user, or you
need permission to view its data. (-1032)")\r

Even though the MS Access file is closed.

I've no administrator rights and I've installed all these as a normal
windows user.

I don't have problem when I write a similar kind of code in PHP. What
could be the reason? Is it because I don't have administrator rights?
or something else?
Please help me out.




More information about the Python-list mailing list