[ruby-oci8-devel] Support FAN in Ruby-OCI8

Christopher Jones christopher.jones at oracle.com
Tue Apr 29 23:57:55 EDT 2008

Setting OCI_EVENT enables ruby-oci8 to receive FAN events.  If
ruby-oci8 uses the OCI session pool, these events will be
automatically handled by the session pool. The DB must be configured
to broadcast FAN events.  The new PHP whitepaper
shows the command the DBA would use.  You have already seen the PHP
OCI8 code that sets OCI_EVENTS at

I'd recommend (i) making ruby-oci8 (i) making the OCI session pool
default (and not bothering with OCI client connection pool - sorry
Shiwei) (ii) making the event setting optional (as Shiwei indicates),
since setting OCI_EVENT will start a monitoring thread.


KUBO Takehiro wrote:
 > Hi,
 > On Fri, Apr 11, 2008 at 5:28 PM, shiwei zhang <shiwei.zhang at oracle.com> wrote:
 >> Hi, Kubo, ruby-oci8-devel,
 >>  I want to implement FAN (Fast Application Notification) functionality
 >>  for Ruby-OCI8. Do you have any concerns about this?
 >>  When we've supported FAN in  Ruby-OCI8, ruby users can still use nearly
 >>  the same APIs to talk to Oracle DB. They are able to choose FAN enabled
 >>  or disabled when using Ruby-OCI8. For single DB instance it's not
 >>  critical to enable FAN, but for multiple DB instances it's much more
 >>  beneficial to enable FAN. In PHP, if a user wants to enable FAN he needs
 >>  to setup "oci8.events = On" in the file php.ini. Yet in Ruby-OCI8 we
 >>  don't have the configuration file like php.ini, so how should we provide
 >>  an interface for ruby user to feed in his choice? Add a parameter in
 >>  OCI8.new()? Add a configuration method for the class OCI8? Do you have
 >>  some suggestions?
 > What API calls do we need to  implement FAN? As far as I looked at PHP CVS
 > repository, it just need to pass OCI_EVENTS to OCIInitialize()'s first
 > parameter.
 > Is it correct?
 > If so, we can not use OCI8.new() to enable FAN, because OCI Environment
 > is initialized before OCI8 class is defined.
 > Two ideas:
 > 1. set a global variable before requiring oci8.
 >        $oci8_events = true
 >        require 'oci8'
 > 2. initialize OCI Environment when it is needed.
 >        require 'oci8'  # don't initialize OCI Environment yet.
 >        OCI8.events = true
 >        conn = OCI8.new(...)   # initialize OCI Environment.
 > _______________________________________________
 > ruby-oci8-devel mailing list
 > ruby-oci8-devel at rubyforge.org
 > http://rubyforge.org/mailman/listinfo/ruby-oci8-devel

Christopher Jones, Oracle
Email: christopher.jones at oracle.com    Tel:  +1 650 506 8630
Blog:  http://blogs.oracle.com/opal/   Free PHP Book: http://tinyurl.com/f8jad
Follow me: http://friendfeed.com/ghrd

More information about the ruby-oci8-devel mailing list