Oracle, ODBC and Rails

Hi,

I have successfully connected to a remote ORACLE DSN using the Actual
ODBC driver (www.actualtechnologies.com) and the ODBC binding for Ruby
by Chris Werner (ODBC Binding for Ruby).

However, when I attempt to connect via ODBC from Ruby on Rails, I get
the following error when starting the web server:

/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/abstract/connection_specification.rb:
34: uninitialized class variable @@allow_concurrency in
ActiveRecord::Base (NameError)

In addition to the ODBC binding mentioned above, I have also installed
OpenLink’s ODBC adapter for Ruby on Rails (http://odbc-
rails.rubyforge.org/).

I’m running Rails 1.2.3 on Mac OS X 10.4.9 (Intel). My Oracle
database is version 10g.

Have you seen this error and/or do you have any idea why it may be
occuring?

Can you share any resources describing how people have successfully
used an Oracle ODBC driver with Ruby on Rails?

Thanks,
Jeff

Jeff wrote:
Jeff,

I am using Oracle 10g with the ruby-oci adapter. I have had no problems
with this adapter. I use it on Windows. I don’t know if there is an OS X
version.

http://rubyforge.org/projects/ruby-oci8

This is the config in database.yml
development:
adapter: oci
username: mytestname
password: mytestpassword
host: server-name/db-instance-name

Andrew

Hi,

I have successfully connected to a remote ORACLE DSN using the Actual
ODBC driver (www.actualtechnologies.com) and the ODBC binding for Ruby
by Chris Werner (ODBC Binding for Ruby).

However, when I attempt to connect via ODBC from Ruby on Rails, I get
the following error when starting the web server:

/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/abstract/connection_specification.rb:
34: uninitialized class variable @@allow_concurrency in
ActiveRecord::Base (NameError)

In addition to the ODBC binding mentioned above, I have also installed
OpenLink’s ODBC adapter for Ruby on Rails (http://odbc-
rails.rubyforge.org/).

I’m running Rails 1.2.3 on Mac OS X 10.4.9 (Intel). My Oracle
database is version 10g.

Have you seen this error and/or do you have any idea why it may be
occuring?

Can you share any resources describing how people have successfully
used an Oracle ODBC driver with Ruby on Rails?

Thanks,
Jeff

hi

2007/5/11, Andrew C. [email protected]:

I don’t know if there is an OS X
version.

From what i remember the problem is that there’s no oci client for OSX
on
Intel machines (which in turn is used by the ruby adapter)…

bye
Luca

Thanks Andrew. The problem is that the Mac OS X Oracle products are
compiled for PPC, not for Intel. I can actually run the Oracle
Instant Client independently (it is supported via Rosetta), but
apparently it doesn’t play with Ruby or Rails – that’s why I’m giving
ODBC a try.

On May 11, 4:42 am, Andrew C. [email protected]

hi,

2007/5/11, Jeff [email protected]:

In addition to the ODBC binding mentioned above, I have also installed
OpenLink’s ODBC adapter for Ruby on Rails (http://odbc-
rails.rubyforge.org/).

I’m not sure if it is relevant, but when using the odbc adapter I’m
amost
sure that you should use odbc as the adapter parameter in database.yml

HTH
Luca

Thanks Luca. You’re right about the odbc parameter in database.yml.
I’m definitely using it and it results in error in my original post.

Is the error you’re getting specific to the Actual ODBC driver? Have
you tried one of OpenLink’s ODBC drivers for Oracle?

The error occurs when loading OpenLink’s ODBC ActiveRecord Adapter
(which is a layer between ActiveRecord and the ODBC driver). I was
not aware that OpenLink has ODBC drivers for Oracle. Perhaps I’ll
give that a shot.

Thanks,
Jeff

I’m in the same boat, using an Intel (x86) Mac and trying to connect
to an Oracle database.

I’m currently using:
OpenLink ODBCAdapter: http://rubyforge.org/projects/odbc-rails/
Ruby ODBC Bindings: ODBC Binding for Ruby
Actual Technologies ODBC driver: http://www.actualtechnologies.com/
($30)

I haven’t been able to get this configuration working correctly
rake db:schema:dump is failing on this line of odbc_adapter.rb in
method ‘columns’:

isNotNullable = (odbcIsNullable.match(‘NO’) != nil)

since odbcIsNullable is nil with this error:
You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.match