Class: ActiveRecord::ConnectionAdapters::JdbcConnection

Inherits:
Object
  • Object
show all
Includes:
ConfigHelper
Defined in:
lib/arjdbc/jdbc/connection.rb

Direct Known Subclasses

PostgresJdbcConnection

Defined Under Namespace

Modules: ConfigHelper

Instance Attribute Summary collapse

Attributes included from ConfigHelper

#config

Instance Method Summary collapse

Methods included from ConfigHelper

#configure_connection, #configure_jdbc, #configure_jndi

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



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/arjdbc/jdbc/connection.rb', line 80

def initialize(config)
  self.config = config
  configure_connection
  connection # force the connection to load
  set_native_database_types
  @stmts = {}
rescue ::ActiveRecord::ActiveRecordError
  raise
rescue Java::JavaSql::SQLException => e
  e = e.cause if defined?(NativeException) && e.is_a?(NativeException) # JRuby-1.6.8
  error = e.getMessage || e.getSQLState
  error = error ? "#{e.java_class.name}: #{error}" : e.java_class.name
  error = ::ActiveRecord::JDBCError.new("The driver encountered an unknown error: #{error}")
  error.errno = e.getErrorCode
  error.sql_exception = e
  raise error
end

Instance Attribute Details

#adapterObject

Returns the value of attribute adapter.



70
71
72
# File 'lib/arjdbc/jdbc/connection.rb', line 70

def adapter
  @adapter
end

#connection_factoryObject (readonly)

Returns the value of attribute connection_factory.



70
71
72
# File 'lib/arjdbc/jdbc/connection.rb', line 70

def connection_factory
  @connection_factory
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


124
125
126
# File 'lib/arjdbc/jdbc/connection.rb', line 124

def active?
  @connection
end

#jndi_connection?Boolean

Returns:

  • (Boolean)


120
121
122
# File 'lib/arjdbc/jdbc/connection.rb', line 120

def jndi_connection?
  @jndi_connection == true
end