FAQ
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).

Search Discussions

  • Jared Still at Jan 14, 2003 at 3:43 am
    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: Jared Still
    INET: jkstill_at_cybcon.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).
  • David Turner at Jan 14, 2003 at 6:46 pm
    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).
  • Jared.Still_at_radisys.com at Jan 14, 2003 at 8:24 pm
    Try killing the processes for an Oracle test database.

    The goal is to fool the listener into thinking the database is
    still up, and creating a server, which should then hang.

    It's worked for me in the past, but not always 100%. May
    take a few tries.

    Jared

    David Turner
    Sent by: root_at_fatcity.com
    01/14/2003 10:46 AM
    Please respond to ORACLE-L



    To: Multiple recipients of list ORACLE-L
    cc:
    Subject: Re: perl timeout

    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).

    --
    Please see the official ORACLE-L FAQ: http://www.orafaq.net
    --
    Author:
    INET: Jared.Still_at_radisys.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).
  • David Turner at Jan 15, 2003 at 12:04 am
    Cool, thx, Dave
    On Tue, Jan 14, 2003 at 12:16:27PM -0800, Jared.Still_at_radisys.com wrote:
    Try killing the processes for an Oracle test database.

    The goal is to fool the listener into thinking the database is
    still up, and creating a server, which should then hang.

    It's worked for me in the past, but not always 100%. May
    take a few tries.

    Jared






    David Turner
    Sent by: root_at_fatcity.com
    01/14/2003 10:46 AM
    Please respond to ORACLE-L


    To: Multiple recipients of list ORACLE-L
    cc:
    Subject: Re: perl timeout


    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).

    --
    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).
  • David Turner at Jan 15, 2003 at 4:54 pm
    Another thing that works is using a connect string to a non existent host. Takes
    forever to return an error. A timeout of 5 seconds in the perl script works.

    Thanks for your help, Dave
    On Tue, Jan 14, 2003 at 12:16:27PM -0800, Jared.Still_at_radisys.com wrote:
    Try killing the processes for an Oracle test database.

    The goal is to fool the listener into thinking the database is
    still up, and creating a server, which should then hang.

    It's worked for me in the past, but not always 100%. May
    take a few tries.

    Jared






    David Turner
    Sent by: root_at_fatcity.com
    01/14/2003 10:46 AM
    Please respond to ORACLE-L


    To: Multiple recipients of list ORACLE-L
    cc:
    Subject: Re: perl timeout


    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).

    --
    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).
  • Tim Bunce at Jan 15, 2003 at 10:15 pm
    I think the new signal handling in perl 5.8 causes problems here.

    The signal is recorded by the *C* signal handler when it happens
    but calling the specified *perl* handler is deferred until it's
    "safe" to do so - generally the next perl statement boundary.

    If the application is stuck in some OS call that gets automatically
    restarted after the signal is 'handled' by the C signal handler then
    it's going to remain stuck.

    A workaround is to using the POSIX module to mark the signal
    as non-restarting - or something like that - I've not had to
    investigate in depth. Google may shed more light.

    Tim.
    On Mon, Jan 13, 2003 at 07:43:57PM -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: Jared Still
    INET: jkstill_at_cybcon.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).
    --
    Please see the official ORACLE-L FAQ: http://www.orafaq.net
    --
    Author: Tim Bunce
    INET: Tim.Bunce_at_pobox.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).

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouporacle-l @
categoriesoracle
postedJan 13, '03 at 11:49p
activeJan 15, '03 at 10:15p
posts7
users4
websiteoracle.com

People

Translate

site design / logo © 2022 Grokbase