Skip to content
Browse files

JDBC drivers need load_driver call for newer versions

Apparently the API here changed and load_driver needs to be called with
newer versions of jdbc-* gems. Only do this if the driver responds to
this method so it keeps working on older versions as well.
  • Loading branch information...
1 parent 7936d3a commit e1201006dba9fe54257f9b8ec3515ab6d1d06696 @dbussink dbussink committed
View
1 do_derby/lib/do_derby.rb
@@ -14,6 +14,7 @@ module Derby
java.lang.Thread.currentThread.getContextClassLoader().loadClass(DataObjects::Derby::JDBC_DRIVER, true)
rescue java.lang.ClassNotFoundException
require 'jdbc/derby' # the JDBC driver, packaged as a gem
+ Jdbc::Derby.load_driver if Jdbc::Derby.respond_to?(:load_driver)
end
require 'do_derby/do_derby' # the Java extension for this DO driver
View
1 do_h2/lib/do_h2.rb
@@ -14,6 +14,7 @@ module H2
java.lang.Thread.currentThread.getContextClassLoader().loadClass(DataObjects::H2::JDBC_DRIVER, true)
rescue java.lang.ClassNotFoundException
require 'jdbc/h2' # the JDBC driver, packaged as a gem
+ Jdbc::H2.load_driver if Jdbc::H2.respond_to?(:load_driver)
end
require 'do_h2/do_h2' # the Java extension for this DO driver
View
1 do_hsqldb/lib/do_hsqldb.rb
@@ -14,6 +14,7 @@ module Hsqldb
java.lang.Thread.currentThread.getContextClassLoader().loadClass(DataObjects::Hsqldb::JDBC_DRIVER, true)
rescue java.lang.ClassNotFoundException
require 'jdbc/hsqldb' # the JDBC driver, packaged as a gem
+ Jdbc::HSQLDB.load_driver if Jdbc::HSQLDB.respond_to?(:load_driver)
end
require 'do_hsqldb/do_hsqldb' # the Java extension for this DO driver
View
1 do_mysql/lib/do_mysql.rb
@@ -13,6 +13,7 @@ module Mysql
java.lang.Thread.currentThread.getContextClassLoader().loadClass(DataObjects::Mysql::JDBC_DRIVER, true)
rescue java.lang.ClassNotFoundException
require 'jdbc/mysql' # the JDBC driver, packaged as a gem
+ Jdbc::MySQL.load_driver if Jdbc::MySQL.respond_to?(:load_driver)
end
# Another way of loading the JDBC Class. This seems to be more reliable
View
1 do_postgres/lib/do_postgres.rb
@@ -13,6 +13,7 @@ module Postgres
java.lang.Thread.currentThread.getContextClassLoader().loadClass(DataObjects::Postgres::JDBC_DRIVER, true)
rescue java.lang.ClassNotFoundException
require 'jdbc/postgres' # the JDBC driver, packaged as a gem
+ Jdbc::Postgres.load_driver if Jdbc::Postgres.respond_to?(:load_driver)
end
# Another way of loading the JDBC Class. This seems to be more reliable
View
1 do_sqlite3/lib/do_sqlite3.rb
@@ -13,6 +13,7 @@ module Sqlite3
java.lang.Thread.currentThread.getContextClassLoader().loadClass(DataObjects::Sqlite3::JDBC_DRIVER, true)
rescue java.lang.ClassNotFoundException
require 'jdbc/sqlite3' # the JDBC driver, packaged as a gem
+ Jdbc::SQLite3.load_driver if Jdbc::SQLite3.respond_to?(:load_driver)
end
# Another way of loading the JDBC Class. This seems to be more reliable

0 comments on commit e120100

Please sign in to comment.
Something went wrong with that request. Please try again.