Class: ActiveRecord::ConnectionAdapters::JdbcConnection

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/connection_adapters/jdbc_adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ JdbcConnection

individual adapter. My guess is that if we loaded two adapters of different types then this is used as a base to be tweaked by each adapter to create @native_database_types



326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
# File 'lib/active_record/connection_adapters/jdbc_adapter.rb', line 326

def initialize(config)
  @config = config.symbolize_keys!
  @config[:retry_count] ||= 5
  @config[:connection_alive_sql] ||= "select 1"
  if @config[:jndi]
    begin
      configure_jndi
    rescue => e
      warn "JNDI data source unavailable: #{e.message}; trying straight JDBC"
      configure_jdbc
    end
  else
    configure_jdbc
  end
  connection # force the connection to load
  set_native_database_types
  @stmts = {}
rescue Exception => e
  raise "The driver encountered an error: #{e}"
end

Instance Attribute Details

#adapterObject

Returns the value of attribute adapter.



316
317
318
# File 'lib/active_record/connection_adapters/jdbc_adapter.rb', line 316

def adapter
  @adapter
end

#connection_factoryObject (readonly)

Returns the value of attribute connection_factory.



316
317
318
# File 'lib/active_record/connection_adapters/jdbc_adapter.rb', line 316

def connection_factory
  @connection_factory
end

Instance Method Details

#jndi_connection?Boolean

Returns:

  • (Boolean)


367
368
369
# File 'lib/active_record/connection_adapters/jdbc_adapter.rb', line 367

def jndi_connection?
  @jndi_connection
end