perlac has asked for the wisdom of the Perl Monks concerning the following question:
I have a perl script that runs fine from the command-line but errors when called from an html page.
The error is 911 Microsoft ODBC Driver Manager Data source name not found and no default driver specified.
I'm using activestate perl version 5.6.1 with ODBC32 version 3.520 on a windows 2k box.
I compared environment settings and all seems to be ok...but, I'm a rookie at this. Can someone help?
Script and HTML Code included.
#!/ap5/bin/perl use Win32::ODBC; $dsn = "ProductionConnect"; if ($db = new Win32::ODBC($dsn)) { $sql = "select campcd, campdesc from crcampcd where campcd = 'AC'"; $db->Sql($sql); print "Content-type: text/html\n\n"; print "<HTML>\n"; print "<HEAD><TITLE>DB Test</TITLE></HEAD>\n"; print "<BODY>\n"; print "Connection Successful...\n\n"; while ($db->FetchRow()) { ($code, $descr) = $db->Data("campcd", "campdesc"); print "$code\n"; print "$descr\n"; print "</BODY>\n"; print "</HTML>\n"; }} else { #($ErrNum, $ErrText, $ErrConn) = $db->Error(); print "Content-type: text/html\n\n"; print "<HTML>\n"; print "<HEAD><TITLE>DB Test</TITLE></HEAD>\n"; print "<BODY>\n"; print Win32::ODBC::Error(); #print "Connection Failed...\n\n"; #print "$ErrNum\n"; #print "$ErrText\n"; #print "$ErrConn\n"; print "</BODY>\n"; print "</HTML>\n"; } $db->Close(); exit(0);
<html><head><title>DB Test</title> <basefont size=5></head> <body> <a href="http://localhost/cgi-bin/dbtest.cgi">Run Test</a> </body> </html>
Best Regards,
R Crawford
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32 ODBC Problem
by strat (Canon) on Jun 26, 2003 at 16:22 UTC | |
|
Re: Win32 ODBC Problem
by Grygonos (Chaplain) on Jun 26, 2003 at 16:13 UTC | |
by Anonymous Monk on Jun 27, 2003 at 16:10 UTC | |
|
Re: Win32 ODBC Problem
by perlac (Initiate) on Jun 27, 2003 at 19:00 UTC |