tags:

views:

356

answers:

2

I made the following programs in Perl before:

my $db = DBconnection with DB2

if ($pid = fork()) {
    #parent
} else {
    #child
    $db->execute("SELECT ****");
    exit;
}

wait();
$db->execute("SELECT ****");

I thought that it waited for the end of the child process to have wanted to do it and would operate it for DB by a pro-process.

In addition, DB is not connected to the contents of the error.

What's wrong?

+4  A: 

There is a lot of stuff you must do to allow a child process to use its parent's DBI handle. See this article on Perl Monks about DBI, fork, and clone.

Chas. Owens
A: 

Try including this line of code in your child block:

$db->{InactiveDestroy} = 1;
bubaker