Skip to content

Instantly share code, notes, and snippets.

@bbrowning
Created April 23, 2012 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bbrowning/2471698 to your computer and use it in GitHub Desktop.
Save bbrowning/2471698 to your computer and use it in GitHub Desktop.
# saved as config/initializers/driver_manager.rb
class Java::java.sql::DriverManager
class << self
alias_method :get_connection_without_oracle, :getConnection
def getConnection(*args)
get_connection_without_oracle(*args)
rescue => e
if args.length == 2 && args[0] =~ /oracle/
Java::oracle.jdbc.OracleDriver.new.connect(*args)
else
raise e
end
end
end
end
@dtrabandt
Copy link

Thanks a lot for that gist. This code snippet helped me a lot to get oracle enhanced running correctly with torquebox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment