Method: Sequel::JDBC.load_driver

Defined in:
lib/sequel/adapters/jdbc.rb

.load_driver(drv, gem = nil) ⇒ Object

Attempt to load the JDBC driver class, which should be specified as a string containing the driver class name (which JRuby should autoload). Note that the string is evaled, so this method is not safe to call with untrusted input. Raise a Sequel::AdapterNotFound if evaluating the class name raises a NameError.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/sequel/adapters/jdbc.rb', line 50

def self.load_driver(drv, gem=nil)
  load_gem(gem) if gem
  if drv.is_a?(String)
    eval drv
  else
    *try, last = drv
    try.each do |try_drv|
      begin
        return eval(try_drv)
      rescue NameError
      end
    end

    eval last
  end
rescue NameError
  raise Sequel::AdapterNotFound, "#{drv} not loaded#{", try installing jdbc-#{gem.to_s.downcase} gem" if gem}"
end