Sha256: 119911aa0a4b5a235402244ea29457d436398ef95bd11d52d13f62340280844e

Contents?: true

Size: 649 Bytes

Versions: 1

Compression:

Stored size: 649 Bytes

Contents

ArJdbc::ConnectionMethods.module_eval do
  def db2_connection(config)
    config[:url] ||= begin
      if config[:host] # Type 4 URL: jdbc:db2://server:port/database
        config[:port] ||= 50000
        "jdbc:db2://#{config[:host]}:#{config[:port]}/#{config[:database]}"
      else # Type 2 URL: jdbc:db2:database
        "jdbc:db2:#{config[:database]}"
      end
    end
    config[:driver] ||= ::ArJdbc::DB2::DRIVER_NAME
    config[:adapter_spec] = ::ArJdbc::DB2
    config[:connection_alive_sql] ||= 'SELECT 1 FROM syscat.tables FETCH FIRST 1 ROWS ONLY'
    jdbc_connection(config)
  end
  alias_method :jdbcdb2_connection, :db2_connection
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord-jdbc-adapter-1.3.0.beta1 lib/arjdbc/db2/connection_methods.rb