I get a Dr. Watson(Perl.exe Exception: access
violation (0xc0000005), Address 0x01e46251) using 
WIN32::ODBC in a child process under NT 4.0. The code
I'm running is shown below. I'm using the Sybase ODBC
driver to access a Sybase 11.5 database on a Solaris
server.

The DW occurs on the DataHash() function call. The DW
does not occur if I run the same code from the parent
process. Is there some reason why I can't use
WIN32::ODBC in a child process? Or is there some other
bug in my code?

Thanks to anyone one who can give me a clue on this
problem.

if($command =~ /^get_Cust_Code/i)
{
    if ($childpid = fork)
    {
       next LOOP;
    }
    else
    {
       my ($handler, $CustNo, $DSN, $dbh, $table,    
%Data, $field, $nwritten,     $reply, $lreply);                                        
  
             ($handler, $CustNo) = split(' ',
$command);
       $DSN = "DSN=MyServer;UID=myid;PWD=mypw";
       $dbh = new Win32::ODBC($DSN);
       $table = "CustInfo";
       $dbh->Sql("SELECT CustID, CustCode FROM $table
where CustNo = ".qw(").$CustNo.qw("));
       while($dbh->FetchRow())
       {
           undef %Data;
           undef $reply;
           %Data = $dbh->DataHash();
           for $field (keys(%Data))
           {
               $reply .=
$field.":\t".$Data{$field}."\t";
           }
           $reply .= "\n";
           $lreply = length($reply);
           $nwritten = syswrite($client, $reply,
$lreply);
           if ($nwritten < $lreply)
           { 
               die "error: couldn't send all data to
client. aborting\n";
           }
        }
        $reply = "..\n";
        $lreply = length($reply);
        $nwritten = syswrite($client, $reply,
$lreply);
        $dbh->Close();
        close $server;
        close $client;
        exit;
    }
}


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl

Reply via email to