3 Replies Latest reply: Apr 30, 2007 8:43 AM by 494029 RSS

    OCI8 - dedicated or shared connection

    494029
      Does anyone know what type of connection is created through ruby-OCI8 using database.yml? Is it a dedicated or shared connection?

      Thanks,

      James
        • 1. Re: OCI8 - dedicated or shared connection
          575020
          I think it's a shared connection.
          In rails/activerecord/lib/active_record/base.rb, it says:
          Connections are usually created through ActiveRecord::Base.establish_connection and retrieved by ActiveRecord::Base.connection. All classes inheriting from ActiveRecord::Base will use this connection. But you can also set a class-specific connection. For example, if Course is a ActiveRecord::Base, but resides in a different database you can just say Course.establish_connection and Course and all its subclasses will use this connection instead.
          This feature is implemented by keeping a connection pool in ActiveRecord::Base that is a Hash indexed by the class. If a connection is requested, the retrieve_connection method will go up the class-hierarchy until a connection is found in the connection pool.
          • 2. Re: OCI8 - dedicated or shared connection
            dvohra21
            The default mode is shared.
            • 3. Re: OCI8 - dedicated or shared connection
              494029
              Thank you!