Using Oracle

Ben Langfeld edited this page Apr 11, 2012 · 4 revisions

DEPRECATION NOTICE: This is old documentation relevant to Adhearsion 1.x and will soon be removed. See the main documentation for up-to-date info.

When Adhearsion initializes Active Record, it does two minor things that cause it to differ from most uses of Active Record:

  • Before each call, it calls ActiveRecord::Base.verify_active_connections!
  • While initializing, it enables concurrency through ActiveRecord::Base.allow_concurrency = true

The Oracle adapter would mysteriously fail to properly service any SQL statement when used with Adhearsion, though the same logic could be broken out of Adhearsion into a separate file and work fine.

Jason Goecke's discovered that the Oracle Active Record adapter (as of Oct. 19th, 2008) is buggy when allow_concurrency is enabled.

The error was this:

(eval):3:in `describe': "DESC MY_TABLE" failed; does it exist? (RuntimeError)

If allow_concurrency was added to the separate standalone file, it demonstrably broke ActiveRecord.

Since it's essential that allow_concurrency be enabled, it's not appropriate for Adhearsion to offer a way to disable it. If you find that the Oracle adapter has still not been fixed, you should fork Adhearsion on Github (see this screencast for how to do that), manually disable allow_concurrency, and then implement your own mutexes around your database access.

##Active Record v2.2.2##

This issue may have been fixed with Active Record version 2.2.2 and later now that Active Record is intrinsically Thread-safe and allow_concurrency is deprecated. This page will be updated when it can be confirmed, but it's very likely that, as long as you're on the latest version of Active Record, you won't ever encounter the error mentioned above.

##Active Record w/JRuby & JDBC##

It has been confirmed that this issue does not exist when using Active Record with the JRuby and JDBC combination with Oracle.