# File lib/arjdbc/jdbc/connection.rb, line 70 def config=(config) @config = config.symbolize_keys end
Configure this connection from the available configuration. @see configure_jdbc @see configure_jndi
@note this has nothing to do with the configure_connection implemented on some of the concrete adapters (e.g. {#ArJdbc::Postgres})
# File lib/arjdbc/jdbc/connection.rb, line 80 def configure_connection 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 end
# File lib/arjdbc/jdbc/connection.rb, line 103 def configure_jdbc if ! config[:url] || ( ! config[:driver] && ! config[:driver_instance] ) raise ::ActiveRecord::ConnectionNotEstablished, "jdbc adapter requires :driver class and :url" end url = configure_url username = config[:username].to_s password = config[:password].to_s jdbc_driver = ( config[:driver_instance] ||= JdbcDriver.new(config[:driver].to_s, config[:properties]) ) @connection_factory = JdbcConnectionFactory.impl do jdbc_driver.connection(url, username, password) end end
Generated with the Darkfish Rdoc Generator 2.