From: KUBO Takehiro Date: 2003-04-12T15:39:10+09:00 Subject: Re: Problem with timeout for DBI on Solaris Hi, Brian Candler writes: > For Oracle, you can try using the ruby-oci8 library from RAA which supports > non-blocking queries (although I don't know if it supports non-blocking > connect). It comes with its own DBD which you have to install manually into > /usr/local/lib/ruby/site_ruby/1.6/DBD/OCI8/OCI8.rb > > Then modify it as follows: > > require 'dbi' > require 'DBD/OCI8/OCI8' > > module DBI > module DBD > module OCI8 > class Driver > def connect( dbname, user, auth, attr ) > handle = ::OCI8.new(user, auth, dbname, attr['Privilege']) > handle.non_blocking = true if attr['NonBlocking'] #<<<< add this line This doesn't work for non-blocking connect because this changes blocking mode to non-blocking *after* the connection is established. Please try following patches: --- oci8.rb~ 2003-03-08 19:11:51.000000000 +0900 +++ oci8.rb 2003-04-12 15:20:10.000000000 +0900 @@ -60,7 +60,7 @@ end include Util - def initialize(uid, pswd, conn = nil, privilege = nil) + def initialize(uid, pswd, conn = nil, privilege = nil, non_blocking = false) if @@env.nil? if OCIEnv.respond_to?("create") @@env = OCIEnv.create() @@ -86,6 +86,7 @@ @auth = @@env.alloc(OCISession) @ctx = [0, Mutex.new, nil] + @svc.attrSet(OCI_ATTR_NONBLOCKING_MODE, nil) if non_blocking @auth.attrSet(OCI_ATTR_USERNAME, uid) @auth.attrSet(OCI_ATTR_PASSWORD, pswd) do_ocicall(@ctx) { @srv.attach(conn) } --- DBD/OCI8/OCI8.rb~ 2002-09-12 23:14:37.000000000 +0900 +++ DBD/OCI8/OCI8.rb 2003-04-12 15:21:43.000000000 +0900 @@ -22,7 +22,7 @@ end def connect( dbname, user, auth, attr ) - handle = ::OCI8.new(user, auth, dbname, attr['Privilege']) + handle = ::OCI8.new(user, auth, dbname, attr['Privilege'], attr['NonBlocking']) return Database.new(handle, attr) rescue OCIError => err raise DBI::DatabaseError.new(err.message, err.code) I've not tested these patches and I don't know whether it works for non-blocking connect. There is no running Oracle server in my Linux box. ;-( Cheers. -- KUBO Takehiro