Module: Kernel

Defined in:
lib/arjdbc/jdbc/require_driver.rb

Instance Method Summary collapse

Instance Method Details

#jdbc_require_driver(path, gem_name = nil) ⇒ Object

load a JDBC driver library/gem, failing silently. If failed, trust that the driver jar is already present through some other means



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/arjdbc/jdbc/require_driver.rb', line 4

def jdbc_require_driver(path, gem_name = nil)
  gem_name ||= path.sub('/', '-')
  2.times do
    begin
      require path
      break
    rescue LoadError
      require 'rubygems'
      begin; gem gem_name; rescue LoadError; end
    end
  end
end