Gossamer Forum
Home : General : Databases and SQL :

Strange CGI/DBI Error, not present at CMD prompt, though.

Quote Reply
Strange CGI/DBI Error, not present at CMD prompt, though.
I'm pulling my hair out so any help is very much appreciated. Here's the scenario:

I have a fully functional perl CGI script that connects to a MySQL database, using DBI, which outputs a list of all records found. (Extremely bare-bones) When I call this script with a web browser it outputs all records as expected. When I run it locally from a command prompt, it also works fine. Here's the catch. When I modify the statement to connect to an Access database, and not the MySQL, using an ODBC driver, I get an error in my browser that says : CGI Error

The specified CGI application misbehaved by not returning a complete set of HTTP headers.



If I run the .cgi script from a DOS prompt, though, everything looks fine. I get the proper "Content-type: text/html" header, and all records are returned as they should be. Bear in my mind, I haven't changed the rest of the script at all from the original. Why would the script work from the DOS prompt, but not when loaded in a browser? Below is the ONLY modification made in my script:



This one works (MySQL)

$dbh = DBI-> connect ("DBI:mysql:host=localhost;database=cars", "Maintenance", "password",{PrintError => 0, RaiseError => 1});



This one does not (Access-ODBC)


$dbh = DBI-> connect ("DBI:ODBC:CarData", {PrintError => 0, RaiseError => 1});



I think that some kind of error is kicking out before the header is output to the web, but this error doesn't happen when run locally. The printout looks PERFECT in a DOS window so I don't get why it's bombing out through a browser. I am running IIS 6.0 with the latest installation of ActivePerl from ActiveState. Please let me know if you need any further info at all. Thanks SOOOOOOO much for any help.

--Seth
Subject Author Views Date
Thread Strange CGI/DBI Error, not present at CMD prompt, though. seth_h 4385 Dec 18, 2003, 9:26 PM
Post Re: [seth_h] Strange CGI/DBI Error, not present at CMD prompt, though.
Alex 4098 Dec 30, 2003, 8:01 PM