Sha256: 305336a20e59393d9e23c99117c4bc497348aa861241bd82aa63d567c51314c8

Contents?: true

Size: 712 Bytes

Versions: 1

Compression:

Stored size: 712 Bytes

Contents

class Java::java.sql::DriverManager
  class << self
    alias_method :get_connection_without_vfs, :getConnection
    alias_method :register_driver_without_vfs, :registerDriver

    def getConnection(url, user, pass)
      url = url.sub(':vfs:', ':')
      get_connection_without_vfs(url, user, pass)
    rescue => e
      # If we didn't register a driver, throw the exception
      raise e unless @driver
      # If we did register a driver, try to connection using it directly
      props = java.util.Properties.new
      props.setProperty("user", user)
      props.setProperty("password", pass)
      @driver.connect(url, props)
    end

    def registerDriver(driver)
      @driver = driver
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
org.torquebox.vfs-1.0.0.Beta23 lib/vfs/ext/jdbc.rb