From: "B@ge" <[EMAIL PROTECTED]> > I am writing a Perl program on Win32 that fork some processes > according to database data. > I used DBI and DBD::ODBC module to connect the database. All my code > is OK but it has application error (like 'this memory address could > not be read') happened. If I delete the database connection code, my > program is normally terminated. > > I had seen the ActivePerl mailing list and found someone also had > the same problem, but I confused > what is the solution of this situation? > > My Perl version is 5.6.1 built for MSWin32-x86-multi-thread > (binary build 629). Below is my code > about database connection and fork. > > $dsn = "driver={SQL > Server};Server=$HOST;database=$DB;uid=$USER;pwd=$PASSWD"; $dbh = > DBI -> connect("dbi:ODBC:$dsn") || die $DBI::errstr; > > if ($child = fork()) { > print "Forked one child(" . abs($child) . ")...\n" > } > elsif (defined $child) { # child > exec "test2.pl"; > }
The only solution until someone updates DBD::ODBC is to call the "DBI->Connect(...);" AFTER the fork(). And prerefably to use DBI only in one thread. Jenda =========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ========== There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain. I can't find it. --- me _______________________________________________ ActivePerl mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/activeperl