Thread View: pl.comp.lang.perl
3 messages
3 total messages
Started by Pasman
Mon, 29 Mar 2010 12:25
połączenie do bazy z kilku wątków
Author: Pasman
Date: Mon, 29 Mar 2010 12:25
Date: Mon, 29 Mar 2010 12:25
39 lines
2219 bytes
2219 bytes
cześć.
tworzę prosty serwerek, który wysyła zapytania do bazy w postgresie.
niestety połączenie z procesów potomnych nie funkcjonuje i wypluwa:
DBD::ODBC::db prepare failed: handle 2 is owned by thread 275014 not
current thr
ead 1ed3abc (handles can't be shared between threads and your driver
may need a
CLONE method added) at E:\WWW\menu3.bat line 53.
jak przerobić to żeby działało ?
############################################
my $dbh = DBI->connect("dbi:ODBC:TEST", "postgres", "postgres")
or do {print "Baza nieczynna !!! ".$DBI::errstr; return};
$dbh->{LongTruncOk} = 1; # use 1 if it is ok to trunc data
$dbh->{LongReadLen} = 8192; # 8kB text max
while ($acc = $sock->accept()) {
unless (fork()) {
print $acc "HTTP/1.0 200 OK\n\n";
print $acc "<html>\n";
my $sth = $dbh->prepare("select * from www(?)");
$sth->execute('A');
while (my $ary = $sth->fetchrow_arrayref) {
print $acc $ary->[0]."\n";
};
$sth->finish;
};
print $@ if $@;
close $acc;
};
Re: połączenie do bazy z kilku wątków
Author: A.L.E.C
Date: Mon, 29 Mar 2010 12:31
Date: Mon, 29 Mar 2010 12:31
15 lines
1444 bytes
1444 bytes
Pasman wrote: > DBD::ODBC::db prepare failed: handle 2 is owned by thread 275014 not > current thr > ead 1ed3abc (handles can't be shared between threads and your driver > may need a > CLONE method added) at E:\WWW\menu3.bat line 53. > > jak przerobić to żeby działało ? Nawiązać nowe połączenie w procesie potomnym. -- Aleksander 'A.L.E.C' Machniak http://alec.pl gg:2275252 LAN Management System Developer http://lms.org.pl Roundcube Webmail Developer http://roundcube.net
Re: połączenie do bazy z kilku wątków
Author: Pasman
Date: Mon, 29 Mar 2010 13:13
Date: Mon, 29 Mar 2010 13:13
4 lines
1340 bytes
1340 bytes
> Nawiązać nowe połączenie w procesie potomnym. dzieki.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads