/local/rvm/gems/ruby-1.9.2-p320/gems/activerecord-sqlserver-adapter-3.2.12/lib/active_record/connection_adapters/sqlserver_adapter.rb:455:in `initialize': IM002 (0) [unixODBC][Driver Manager]Data source name not found, and no default driver specified (ODBC::Error)
I have working copy of my app but suddenly overnight I left my system like that and this error started surfacing. Can anyone tell how to fix this one please?
I dont know what driver you are using, but I would guess either a update has changed things.
Can you connect to the data source using isql?
If you could post a copy of your /etc/odbc.ini and /etc/odbcinst.ini file it would let me see what its trying to connect to.
There is no definitive answer to your question since you gave us nothing to work on.
However, the possible reasons for this are:
the DSN you specified could not be found in your user or system odbc.ini files Run odbcinst -j to find where those files are Has someone changed/removed them?
You set ODBCINI env var or ODBCSYSINI env var to point unixODBC at the location of your odbc.ini and odbcinst.ini files and now they are not set (or changed).
Someone has removed or moved your ODBC driver
You normally run your code as user A and now you are running it as user B and you are using user datasources or set ODBCINI env var.
... probably others but if you'd given us better information we wouldn't have to guess.
You should start by setting up and configuring FreeTDS. Here is a sample configurations from my files, but I'm sure other variants will work also. One difference is that I'm using Django, but the result below still worked eventually, but it works much better with SQL authentication than with Windows Authentication.
From
/etc/freetds/freetds.conf
(use the IP of the server if DNS is not active for the server name).From
/etc/odbcinst.ini
From
/etc/odbc.ini
Then this command connects me to the database.
tsql -S MyServer -U username@servername -P password
just a tip, in my case was not possible with Driver = FreeTDS and both variables "servername" and "server" in odbc.ini. I let only "server = ip" and "Driver = /usr/lib/i386-linux-gnu/odbc/libtdsodbc.so", worked fine.