> -----Original Message-----
> From: Jim Cain [mailto:list / jimcain.us] 
> Sent: Tuesday, July 01, 2003 10:04 AM
> To: ruby-talk / ruby-lang.org
> Subject: DBD::Oracle9 and non-blocking mode
> 
> 
> I'm about ready to make available an early copy of my 
> library, but first 
> I have some questions regarding non-blocking mode. I've never 
> actually 
> used this feature, so I'd like to hear from those that do how 
> they use 
> it. Do you need more support for it beyond simply 
> setting/resetting the 
> mode? What is the most convenient way for you to be notified 
> that an OCI 
> call is still executing? When a call is still running, would 
> you like to 
> call Statement#execute again to see if it's finished, or 
> would you like 
> some other method?
> 
> Thanks for the input.
> 
> Cheers,
> Jim

Hi Jim,

I use it to timeout connect calls when a database is either down and/or
unreachable for some reason.  This is rare, but it does happen, either
because of a network glitch or a snapshot is going on, or it's just down.
Here's a code snippet.

require "dbi"
require "timeout"

begin
   timeout(10){
      DBI.connect("dbi:oracle:mydsn",user,passwd)
   }
rescue TimeoutError
   # perhaps sleep & retry, perhaps exit
rescue
   # some other error
end

As things stand now the timeout block does nothing and it takes 1-2 minutes
(!) for the connect attempt to timeout if something goes wrong.

I also refer you to my original post about this problem at
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/68854

Regards,

Dan