I am trying to query a database on a server by running a perl script through a IE web browser. I have IIS 5.0 running on a Windows 2000 server with SP4. I have built a System Data Set Name called ResNet on the IIS server. Perl 5.6.1 is loaded on the IIS server.
I wrote a perl scripts that runs fine from the command when I am logged on to the IIS server (see code below)
##########################################
use win32::odbc;
$dsn = "ResNet";
$db = new Win32::ODBC( "$dsn" ) || die "Error connecting: " .
Win32::ODBC::Error();
if( !$db->Sql( $sql = "SELECT * FROM bylogin WHERE login = 'ewatts'"))
{
if( $db->FetchRow() )
{
my(%data) = $db->DataHash();
$loginname = $data{'login'};
print "LOGINNAME $loginname\n";
exit;
}
else
{
`"c:\\program files\\internet explorer\\iexplore.exe" http://princess.spelman.edu/resnet.nsf/resnet?openform`;
}
}
$db = new Win32::ODBC($dsn);
$db->Sql($sql);
($ErrNum, $ErrText, $ErrConn) = $db->Error();
##################################
However, I want to be able to have this script ran by others by using a web browser. I modified the script above to run from a web browser as follows:
######################################
use CGI::Carp qw(fatalsToBrowser);
use Win32::ODBC;
print<<HTML;
<html>
<head>
<title>ID Renewal Request Screen
</title>
</head>
<body>
<h1><center><font color="green">$domainName
<font color="black">Customer Service Group
</center>
<CENTER><font color="green">$requestType
<font color="black">Request </center></h1>
<br>
HTML
$dsn = "ResNet";
$db = new Win32::ODBC( "$dsn"
) || die "Error connecting: " .
Win32::ODBC::Error();
if( !$db->Sql( $sql = "SELECT
* FROM bylogin WHERE login = 'ewatts'"))
{
if(
$db->FetchRow() )
{
my(%data)
= $db->DataHash();
$loginname
= $data{'login'};
print
"LOGINNAME $loginname\n";
exit;
}
else
{
print
"hello2";
`"c:\\program
files\\internet explorer\\iexplore.exe" http://princess.spelman.edu/resnet.nsf/resnet?openform`;
}
}
$db = new Win32::ODBC($dsn);
$db->Sql($sql);
($ErrNum, $ErrText, $ErrConn) = $db->Error();
;
######################
When I bring up a web browser and
try to run the script, I get this error:
######################
Customer Service Group
Request
Content-type: text/html
Software error:
Error connecting: [911] [] "[Microsoft][ODBC Driver Manager] Driver's SQLAllocHandle on SQL_HANDLE_DBC failed" at c:\inetpub\scripts\test.pl line 25.
For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.
I have also tried to use the admin ID and password for the database in the modified script but get the same error!!!!!
HELP!!!!!!!!
Eugene P. Watts
MIT System Admin/Engineer
Spelman College
350 Spelman Lane, SW, Box 141
Atlanta, Georgia 30314-4399
(404) 270-5407 Work
(404) 867-7303 Cell
[EMAIL PROTECTED]
_______________________________________________ Perl-Win32-Users mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
