multiple db connections
From: gary (No_at_Thanks.com)
Date: 03/24/04
- Previous message: Lincoln A. Baxter: "Re: SUCCESS: DBD::Oracle 1.15 on HP-UX 11.11"
- Next in thread: gary: "Re: multiple db connections"
- Reply: gary: "Re: multiple db connections"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 24 Mar 2004 06:09:42 GMT
Hi,
I have a dbd/mysql application which runs without issue. I'm trying to
move it to a newer machine and see that it fails. The application
forks() and the child opens it's own db connection. When the child
does the disconnect, the parents connection goes away too. This was
not the behavior on the older version. How do I prevent that from
happening?
Even without forking, if I open two connections and close one, the
second connection goes away too:
$dsn = "DBI:mysql:database=$db;host=$db_host";
# connect to the database
my $dbh = DBI->connect($dsn, $db_user_name, $db_password);
my $dbh2 = DBI->connect($dsn, $db_user_name, $db_password);
my $expected_version = "2.0"; #templates, versions et al
my $db_version1 = $dbh->selectrow_array(qq{SELECT db_version FROM
sysadmin});
print("version1 is $db_version1\n");
my $db_version2 = $dbh->selectrow_array(qq{SELECT db_version FROM
sysadmin});
print("version2 is $db_version2\n");
$dbh->disconnect();
my $db_version3 = $dbh->selectrow_array(qq{SELECT db_version FROM
sysadmin});
print("version3 is $db_version3\n");
print("JobQueue deamon exiting\n");
and when run on the old machine:
Wed Mar 24 00:59:38 2004: version1 is 2.0
Wed Mar 24 00:59:38 2004: version2 is 2.0
Wed Mar 24 00:59:38 2004: version3 is 2.0
Wed Mar 24 00:59:38 2004: JobQueue deamon exiting
and on the new machine:
version1 is 2.0
version2 is 2.0
DBD::mysql::db selectrow_array failed: MySQL server has gone away at
test.pl line 98.
Use of uninitialized value at test.pl line 99 (#1)
(W) An undefined value was used as if it were already defined. It
was
interpreted as a "" or a 0, but maybe it was a mistake. To
suppress this
warning assign an initial value to your variables.
version3 is
JobQueue deamon exiting
The old verion of DBD is $VERSION = '2.1026';
and the new version is $VERSION = '2.9003';
both compters are running freebsd 4.6.2 and perl is:
This is perl, version 5.005_03 built for i386-freebsd
what am I mssing?
thanks,
gary
- Previous message: Lincoln A. Baxter: "Re: SUCCESS: DBD::Oracle 1.15 on HP-UX 11.11"
- Next in thread: gary: "Re: multiple db connections"
- Reply: gary: "Re: multiple db connections"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]