CGI, Apache, and mxODBC

Jessica Elkaim A.Concept at wanadoo.fr
Sat Jan 29 11:52:45 EST 2000


	Apparently you don't have a DSN named Allegro in your ODBC Setup.

	Add this DSN as a 'system DSN' because if Apache runs under a different
user id it may not find the correct DSN.

	Hope that helps,
	Cyril Elkaim

"Paul E. Bible" a écrit :
> 
> Just some more information that I found relating to my problem.  I thought
> it might in the diagnosis...
> These are the error message lines from Apache:
> 
> File "c:/apache/cgi-bin/sql.py", line 13, in Main
> db = Odbc.Windows.Connect('Allegro','helistest','oilwell')
> mxODBC.OperationalError: ('IM002', 0, '[Microsoft][ODBC Driver Manager] Data
> source name not found and no default driver specified', 4265)
> 
> Thanks again,
> Paul
> 
> "Paul E. Bible" <pbible at home.com> wrote in message
> news:6p1g4.35$iL4.1041 at news.rdc1.tx.home.com...
> > Hi all,
> >
> > First of all, sorry for the length of this message...
> >
> > Okay, I've been successful in getting Python CGI scripts to run under
> Apache
> > 1.3.9 under Windows/NT.  Now it's time to add database functionality using
> > mxODBC to the script, but I'm encountering some problems.  I have provided
> > my script and the Apache environment debug listing below.
> >
> > The script, as written, gives me a Internal Server Error.  If I comment
> out
> > the lines dealing with mxODBC (i.e., db = Odbc.Win..., etc.), the script
> > works fine; just doesn't do much.
> >
> > Thanks in advance your help,
> > Paul
> >
> > --------------------------------------------------------------------------
> --
> > ---
> > #!c:\progra~1\python\python.exe
> >
> > import os, string, sys, cgi, re, Odbc
> >
> > def Main():
> >      sql = 'Select * from cashacct'
> >
> >      db = Odbc.Windows.Connect('TestDB','testid','testpw')
> >
> >      # Add the columns
> >      cols = ()
> >      c = db.cursor()
> >      c.execute(sql)
> >      cols = c.description
> >
> >      # Print the HTML header info
> >      print "Content-type: text/html"
> >      print
> >      print "<HTML>"
> >      print "<HEAD>"
> >      print "SQL Statement Test"
> >      print "</HEAD>"
> >      print "<BODY>"
> >
> >      # Add the columns to the Access table
> >      print '<table border="0">'
> >      print "<tr>"
> >      for idx in range(len(cols)):
> >           print "<td>" + cols[idx][0] + "</td>"
> >      print "</tr>"
> >      print "</table>"
> >
> >      print "</BODY>"
> >      print "</HTML>"
> >      sys.exit(0)
> >
> > Main()
> >
> > --------------------------------------------------------------------------
> --
> > ---
> >
> > Shell Environment:
> > COMSPEC
> > D:\WINNT\system32\cmd.exe
> > DOCUMENT_ROOT
> > c:/apache/htdocs
> > GATEWAY_INTERFACE
> > CGI/1.1
> > HTTP_ACCEPT
> > image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
> > application/vnd.ms-powerpoint, application/vnd.ms-excel,
> application/msword,
> > application/x-comet, */*
> > HTTP_ACCEPT_ENCODING
> > gzip, deflate
> > HTTP_ACCEPT_LANGUAGE
> > en-us
> > HTTP_CONNECTION
> > Keep-Alive
> > HTTP_HOST
> > XX.X.XX.XXX
> > HTTP_REFERER
> > http://XX.X.XX.XXX/blank.htm
> > HTTP_USER_AGENT
> > Mozilla/4.0 (compatible; MSIE 5.01; Windows NT)
> > PATH
> >
> C:\orant\bin;D:\WINNT\system32;D:\WINNT;C:\RECYCLER\S-1-5-21-862944694-15761
> >
> 02806-697575874-500\DC0;C:\RECYCLER\S-1-5-21-862944694-1576102806-697575874-
> > 500\DC0\Perl;c:\Program Files\Symantec\pcAnywhere;c:\Program Files\python
> > PYTHONPATH
> > c:\Program Files\python;c:\Program Files\Lib;c:\Program
> > Files\python\lib\tkinter;c:\Program Files\python\win32com;c:\Program
> > Files\python\win32
> > PYTHONUNBUFFERED
> > 1
> > QUERY_STRING
> > sql=select+*+from+cashacct&submit-button=Submit
> > REMOTE_ADDR
> > XX.X.XX.XXX
> > REMOTE_PORT
> > 1052
> > REQUEST_METHOD
> > GET
> > REQUEST_URI
> > /cgi-bin/sql.py?sql=select+*+from+cashacct&submit-button=Submit
> > SCRIPT_FILENAME
> > c:/apache/cgi-bin/sql.py
> > SCRIPT_NAME
> > /cgi-bin/sql.py
> > SERVER_ADDR
> > XX.X.XX.XXX
> > SERVER_ADMIN
> > webmaster at home.com
> > SERVER_NAME
> > XX.X.XX.XXX
> > SERVER_PORT
> > 80
> > SERVER_PROTOCOL
> > HTTP/1.1
> > SERVER_SIGNATURE
> > <ADDRESS>Apache/1.3.9 Server at 24.6.21.112 Port 80</ADDRESS>
> > SERVER_SOFTWARE
> > Apache/1.3.9 (Win32)
> > SystemRoot
> > D:\WINNT
> > WINDIR
> > D:\WINNT
> > None
> > These environment variables could have been set:
> > AUTH_TYPE
> > CONTENT_LENGTH
> > CONTENT_TYPE
> > DATE_GMT
> > DATE_LOCAL
> > DOCUMENT_NAME
> > DOCUMENT_ROOT
> > DOCUMENT_URI
> > GATEWAY_INTERFACE
> > LAST_MODIFIED
> > PATH
> > PATH_INFO
> > PATH_TRANSLATED
> > QUERY_STRING
> > REMOTE_ADDR
> > REMOTE_HOST
> > REMOTE_IDENT
> > REMOTE_USER
> > REQUEST_METHOD
> > SCRIPT_NAME
> > SERVER_NAME
> > SERVER_PORT
> > SERVER_PROTOCOL
> > SERVER_ROOT
> > SERVER_SOFTWARE
> > In addition, HTTP headers sent by the server may be passed in the
> > environment as well. Here are some common variable names:
> > HTTP_ACCEPT
> > HTTP_CONNECTION
> > HTTP_HOST
> > HTTP_PRAGMA
> > HTTP_REFERER
> > HTTP_USER_AGENT
> > None
> >
> >
> >



More information about the Python-list mailing list