我在Ubuntu(12.10)上遇到ODBC問題。關於它的最奇怪的部分 - 我在一年前完成了所有這些工作,直到最近還沒有遇到任何麻煩。osql找不到IP地址,tsql在Ubuntu上工作
我想連接到使用FreeTDS/ODBC的MS SQL Server。我主要使用sqsh與服務器交談,但是當我需要做任何分析時,我使用RODBC將數據提取到R中。昨天,當我試圖做到這一點時,它失敗了。
我可以使用sqsh/tsql連接到數據庫。這使我認爲FreeTDS仍然正確設置。這個問題似乎在ODBC方面。所以,我拿出了osql,我得到了最奇怪的錯誤。
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"
我不明白爲什麼osql試圖解析IP地址時,它已經。此服務器有相當多的IP阻塞來幫助保護它,並且您只能從一組列入白名單的IP地址訪問它。您無法在地址上進行DNS查找。我在辦公室,所以我的IP地址很好,而且,我可以使用tsql進行連接,所以這部分應該不成問題,但這看起來像是失敗點。
想法?
另一個說明,actwd.net是我們的房東。所以,這不完全是簡單的,我只是不知道爲什麼它不使用我交付的IP地址。
'osql'做:'HOST = $(主機$ {HOST} | awk的 '/域/ {打印$ 5}' | sed中的/\.$//')'所以如果有什麼不妥之處,它會告訴你「沒有DNS主機名」。在我的情況下,'host'命令沒有安裝。 –