2 module ConnectionAdapters
6 @driver = driver_class.new
10 @driver_class ||= begin
11 driver_class_const = (@name[0...1].capitalize + @name[1..@name.length]).gsub(/\./, '_')
12 Jdbc::Mutex.synchronized do
13 unless Jdbc.const_defined?(driver_class_const)
14 driver_class_name = @name
16 java_import(driver_class_name) { driver_class_const }
20 driver_class = Jdbc.const_get(driver_class_const)
21 raise "You must specify a driver for your JDBC connection" unless driver_class
26 def connection(url, user, pass)
27 # bypass DriverManager to get around problem with dynamically loaded jdbc drivers
28 props = java.util.Properties.new
29 props.setProperty("user", user)
30 props.setProperty("password", pass)
31 @driver.connect(url, props)