Classes and Modules
- Sequel::JDBC::DB2
- Sequel::JDBC::Derby
- Sequel::JDBC::H2
- Sequel::JDBC::HSQLDB
- Sequel::JDBC::JTDS
- Sequel::JDBC::JavaSQL
- Sequel::JDBC::MSSQL
- Sequel::JDBC::MySQL
- Sequel::JDBC::Oracle
- Sequel::JDBC::Postgres
- Sequel::JDBC::SQLServer
- Sequel::JDBC::SQLite
- Sequel::JDBC::SqlAnywhere
- Sequel::JDBC::Transactions
- Sequel::JDBC::Database
- Sequel::JDBC::Dataset
- Sequel::JDBC::TypeConvertor
Constants
DATABASE_ERROR_CLASSES | = | [NativeException] |
Default database error classes |
|
DATABASE_SETUP | = | {} |
Contains procs keyed on subadapter type that extend the given database object so it supports the correct database type. |
|
JNDI_URI_REGEXP | = | /\Ajdbc:jndi:(.+)/ |
Used to identify a jndi connection and to extract the jndi resource name. |
|
NativeException | = | Java::JavaLang::Exception |
Create custom |
Public Class methods
load_driver(drv, gem=nil)
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.
[show source]
# File lib/sequel/adapters/jdbc.rb 50 def self.load_driver(drv, gem=nil) 51 load_gem(gem) if gem 52 if drv.is_a?(String) 53 eval drv 54 else 55 *try, last = drv 56 try.each do |try_drv| 57 begin 58 return eval(try_drv) 59 rescue NameError 60 end 61 end 62 63 eval last 64 end 65 rescue NameError 66 raise Sequel::AdapterNotFound, "#{drv} not loaded#{", try installing jdbc-#{gem.to_s.downcase} gem" if gem}" 67 end
load_gem(name)
Allow loading the necessary JDBC
support via a gem.
[show source]
# File lib/sequel/adapters/jdbc.rb 34 def self.load_gem(name) 35 require "jdbc/#{name.to_s.downcase}" 36 rescue LoadError 37 # jdbc gem not used, hopefully the user has the .jar in their CLASSPATH 38 else 39 if defined?(::Jdbc) && ( ::Jdbc.const_defined?(name) rescue nil ) 40 jdbc_module = ::Jdbc.const_get(name) # e.g. Jdbc::SQLite3 41 jdbc_module.load_driver if jdbc_module.respond_to?(:load_driver) 42 end 43 end