Re: FW: Db ping function

  • From: Jared Still <jkstill@xxxxxxxxx>
  • To: mark.bobak@xxxxxxxxxxxxxxx
  • Date: Mon, 20 Sep 2004 10:08:30 -0700

> 
> 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@xxxxxxxxxxxxxxx> 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
--
//www.freelists.org/webpage/oracle-l

Other related posts: