I am having ODBC problems on Ubuntu (12.10). The weirdest part about it - I set all of this up a year ago and haven't had any trouble with it until recently.
I am trying to connect to a MS SQL Server using FreeTDS / ODBC. I primarily use sqsh to talk to the server, but when I need to do anything analytical, I pull the data into R using RODBC. Yesterday, when I tried to do this, it failed.
I can connect to the database using sqsh / tsql. This makes me think FreeTDS is still set up correctly. The problem seems to be on the ODBC side. So, I pulled out osql and I get the strangest error.
checking shared odbc libraries linked to isql for default directories...
strings: '': No such file
trying /tmp/sql ... no
trying /tmp/sql ... no
trying /etc ... OK
checking odbc.ini files
reading /home/andy/.odbc.ini
[CANS] found in /home/andy/.odbc.ini
found this section:
[CANS]
Description = FreeTDS
Driver = FreeTDS
Servername = Portland
Database = CANS
UID = NotRelevant
PWD = NotRelevant
Port = 1433
looking for driver for DSN [CANS] in /home/andy/.odbc.ini
found driver line: " Driver = FreeTDS"
driver "FreeTDS" found for [CANS] in .odbc.ini
found driver named "FreeTDS"
"FreeTDS" is not an executable file
looking for entry named [FreeTDS] in /etc/odbcinst.ini
found driver line: " Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so"
found driver /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so for [FreeTDS] in
odbcinst.ini
/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so is an executable file
Using ODBC-Combined strategy
DSN [CANS] has servername "Portland" (from /home/andy/.odbc.ini)
cannot read "/home/andy/.freetds.conf"
/etc/freetds/freetds.conf is a readable file
looking for [Portland] in /etc/freetds/freetds.conf
found this section:
[Portland]
host = 63.***.**.***
port = 1433
tds version = 8.0
client charset = UTF-8
looking up hostname for ip address 63.***.**.***
osql: no IP address found for "host145.actwd.net"
I don't understand why osql is trying to resolve an IP address when it has it already. This server has quite a bit of IP blocking going on to help protect it and you can only access it from a set of white-listed IP addresses. You can't do a DNS lookup on the address. I'm at the office so my IP address is fine and furthermore, I can connect using tsql, so this part shouldn't be a problem, but this looks like the failure point.
Thoughts?
One other note, actwd.net is our host. So, this isn't totally zany, I just don't know why it doesn't use the IP address I'm handing it.