Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: FW: Db ping function

Re: FW: Db ping function

From: Jared Still <jkstill_at_gmail.com>
Date: Mon, 20 Sep 2004 10:08:30 -0700
Message-ID: <bf46380409201008416d9e20@mail.gmail.com>


>
> FYI: select SYSDATE from DUAL /* ping */ is the method by which the
> DBD::Oracle perl module checks to make sure it has a connection to the
> database. It's not in our code -- it's in the perl DBI/DBD code! There
> has
> to be some way to disable it, because I'm pretty sure it's not
> necessary.

On Mon, 20 Sep 2004 12:31:31 -0400, Bobak, Mark <mark.bobak_at_il.proquest.com> wrote:
> Ok, Perl experts....any thoughts/comments/suggestions on this one?
> Any way to disable this?
>

The ping method is part of the DBI module, and does nothing.

The driver method is used to over-ride it. Here is ping from DBD::Oracle:

   sub ping {
   my($dbh) = @_;
   my $ok = 0;
   eval {

       local $SIG{__DIE__};
       local $SIG{__WARN__};
       # we know that Oracle 7 prepare does a describe so this will
       # actually talk to the server and is this a valid and cheap test.
       my $sth =  $dbh->prepare("select SYSDATE from DUAL /* ping */");
       # But Oracle 8+ doesn't talk to server unless we describe the query
       $ok = $sth && $sth->FETCH('NUM_OF_FIELDS');
   };
   return ($@) ? 0 : $ok;
    }

Obviously it does a select from dual.

It is not called implicitly by the DBD::Oracle module though, so it *is* in their code, somewhere.

Jared

--
http://www.freelists.org/webpage/oracle-l
Received on Mon Sep 20 2004 - 12:04:04 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US