JNDI_URI_REGEXP | = | /\Ajdbc:jndi:(.+)/ | Used to identify a jndi connection and to extract the jndi resource name. | |
DATABASE_SETUP | = | {} | Contains procs keyed on subadapter type that extend the given database object so it supports the correct database type. | |
NativeException | = | java.lang.Exception | Create custom NativeException alias for nicer access, and also so that JRuby 9.2+ so it doesn‘t use the deprecated ::NativeException | |
DATABASE_ERROR_CLASSES | = | [NativeException] | Default database error classes | |
StoredProcedureMethods | = | prepared_statements_module( "sql = @opts[:sproc_name]; opts = Hash[opts]; opts[:args] = @opts[:sproc_args]; opts[:sproc] = true", Sequel::Dataset::StoredProcedureMethods, %w"execute execute_dui") do private |
schema_parse_table | -> | jdbc_schema_parse_table |
tables | -> | jdbc_tables |
views | -> | jdbc_views |
indexes | -> | jdbc_indexes |
jdbc_schema_parse_table | -> | schema_parse_table |
jdbc_tables | -> | tables |
jdbc_views | -> | views |
jdbc_indexes | -> | indexes |
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.
# File lib/sequel/adapters/jdbc.rb, line 52 52: def self.load_driver(drv, gem=nil) 53: load_gem(gem) if gem 54: eval drv 55: rescue NameError 56: raise Sequel::AdapterNotFound, "#{drv} not loaded#{", try installing jdbc-#{gem.to_s.downcase} gem" if gem}" 57: end
Allow loading the necessary JDBC support via a gem.
# File lib/sequel/adapters/jdbc.rb, line 34 34: def self.load_gem(name) 35: begin 36: require "jdbc/#{name.to_s.downcase}" 37: rescue LoadError 38: # jdbc gem not used, hopefully the user has the .jar in their CLASSPATH 39: else 40: if defined?(::Jdbc) && ( ::Jdbc.const_defined?(name) rescue nil ) 41: jdbc_module = ::Jdbc.const_get(name) # e.g. Jdbc::SQLite3 42: jdbc_module.load_driver if jdbc_module.respond_to?(:load_driver) 43: end 44: end 45: end