Hello?

Hello?

am 21.04.2004 16:06:55 von KEG

Is this mailing list still active???

If so, I was inquiring about the best method for ensuring a database
handle is still valid.

If the database is down or the connection fails or anything that will
cause operations on a database handle to fail, will my database handle
be undefined then? I wonder because the following code gives me
inconsistent results when the system load gets high:

if (!defined($dbh1)) {
.....


Is this a rock solid way of testing your database connection? Does
anyone use $dbh1->ping??? The documentation says that unless you know
for sure you need to use the ping() method, your likely don't.

Basically I have a daemon written in perl that runs 24/7 and analyzes
various processes and logs information to a mysql database. Inside my
main loop I check the database handle each iteration and if it is down,
I spin until a connection can be re-established. However, my problem
lies in the testing of the connection and how to properly do this.

I can't afford to disconnect and reconnect, this is a very
high-throughput process. I also want to avoid using a SQL query just to
test if the database handle is still valid or not.

My environment is RH 9 running a vanilla 2.4.20-28.9smp kernel, a
vanilla build of mysql-max-4.0.18, perl DBI 1.42, DBD::mysql 2.9003, and
vanilla perl 5.8.

Thx,
Keg


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: Hello?

am 21.04.2004 22:37:56 von David Dick

> if (!defined($dbh1)) {
> ....
>
>
> Is this a rock solid way of testing your database connection? Does
> anyone use $dbh1->ping??? The documentation says that unless you know
> for sure you need to use the ping() method, your likely don't.
>

ping has been defined for DBD::mysql so it does work.

the $dbh->{mysql_auto_reconnect} attribute may also be what you want.


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: Hello?

am 21.04.2004 22:37:56 von David Dick

> if (!defined($dbh1)) {
> ....
>
>
> Is this a rock solid way of testing your database connection? Does
> anyone use $dbh1->ping??? The documentation says that unless you know
> for sure you need to use the ping() method, your likely don't.
>

ping has been defined for DBD::mysql so it does work.

the $dbh->{mysql_auto_reconnect} attribute may also be what you want.


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: Hello?

am 21.04.2004 23:49:11 von KEG

David Dick wrote:
>
>> if (!defined($dbh1)) {
>> ....
>>
>>
>> Is this a rock solid way of testing your database connection? Does
>> anyone use $dbh1->ping??? The documentation says that unless you know
>> for sure you need to use the ping() method, your likely don't.
>>
>
> ping has been defined for DBD::mysql so it does work.
>
> the $dbh->{mysql_auto_reconnect} attribute may also be what you want.
>
>


Cool thanks all.

_kg


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: Hello?

am 21.04.2004 23:49:11 von KEG

David Dick wrote:
>
>> if (!defined($dbh1)) {
>> ....
>>
>>
>> Is this a rock solid way of testing your database connection? Does
>> anyone use $dbh1->ping??? The documentation says that unless you know
>> for sure you need to use the ping() method, your likely don't.
>>
>
> ping has been defined for DBD::mysql so it does work.
>
> the $dbh->{mysql_auto_reconnect} attribute may also be what you want.
>
>


Cool thanks all.

_kg


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org