I am attempting to get code working that connects to a MS SQL server
from a Linux web server. My testing in irb works, but when I try it in
rails I have no such luck. Sorry about the long post.
I have install and tested FreeTDS (works), and unixODBC (works). I
have a working ODBC connector called CTEL.
I have also installed RubyDBI and RubyODBC. I tested those by starting
irb1.8 and executing the following code:
dbh = DBI.connect(‘dbi:ODBC:CTEL’, ‘usrename’, ‘password’)
sth = dbh.execute(“SELECT Org_ID FROM Org”)
while row = sth.fetch do
(Where username and password are the correct values.) It works
perfectly and prints out all of the Org_IDs. So, it looks like I have
all of the prereqs workings and life is good.
However, when I start working in rails things don’t go as smoothly. My
database.yml looks like:
My model is legacy_customer.rb:
class LegacyCustomer < ActiveRecord::Base
Next I open up script/console and type “test = LegacyCustomer.new” and
get the following:
DBI::DatabaseError: INTERN (0) [RubyODBC]No data found
=' from /usr/local/lib/site_ruby/1.8/dbi/dbi.rb:733:in=’
sqlserver_connection' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:251:insend’
connection_without_query_cache=' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/query_cache.rb:54:inconnection=’
retrieve_connection' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:inconnection’
columns' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1969:inattributes_from_column_definition’
initialize_without_callbacks' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/callbacks.rb:236:ininitialize’
from (irb):1:in `new’
Any ideas on what I could do from here?
Thanks for the help,