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: perl timeout

Re: perl timeout

From: David Turner <turner_at_tellme.com>
Date: Tue, 14 Jan 2003 10:46:44 -0800
Message-ID: <F001.0052F715.20030114104644@fatcity.com>


Thx I left your book in Missouri:( Now I'm trying to simulate a database with hanging connections to test the script. Anyone know how best to simulate that?

Dave
On Mon, Jan 13, 2003 at 07:43:29PM -0800, Jared Still wrote:
>
> Gee Dave, I know of a book that has scripts that
> already do this. ;)
>
> Here's an untested bit of code to demonstrate.
>
> my $dbh;
>
> eval {
>
> local $SIG{ALRM} = sub {
> die "connection timeout\n";
> };
>
> alarm 60;
>
> $dbh = DBI->connect(
> 'dbi:Oracle:' . $db,
> $username, $password,
> {
> RaiseError => 1,
> AutoCommit => 0,
> }
>
> );
>
> };
>
> # the alarm reset must be outside the eval{}
> alarm 0;
>
> I say untested cuz I simplified it a bit after lifting
> it from a script.
>
> HTH,
>
> Jared
>
> On Monday 13 January 2003 15:49, David Turner wrote:
> > Does anyone have some perl code that will return an error if it take longer
> > than a certain number of seconds to connect to or return the results from a
> > database? I'd like to have some of my queries connect to an alternate
> > database if there is a problem connecting or returning results within 10
> > seconds. Any other suggestions are appreciated.
> >
> > Dave

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: David Turner
  INET: turner_at_tellme.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Tue Jan 14 2003 - 12:46:44 CST

Original text of this message

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