web-dev-qa-db-ja.com

FreeTDS-接続できません:Adaptive Serverが使用できないか、存在しません

CENTOS 6.5 x86_64 WHM 11.42.1 unixODBC 2.2.14

freetds v0.91

リモートMSSQLサーバーに接続しようとしていますが成功しません-異なるtdsバージョン(4.2、7.0、7.1、8.0)で接続しようとしましたが、すべて同じ結果になります。

同じサーバー名、ポート、ユーザー名、パスワードを使用して、Win7とSQL Server ManagementStudioを使用してデスクトップ経由で接続できます。

Telnetも失敗します。

詳細は以下の通りです。これ以上必要な場合はお知らせください。すべてのヘルプ/アドバイスに感謝します。

========

tsql -C

Compile-time settings (established with the "configure" script)
                            Version: freetds v0.91
             freetds.conf directory: /etc
     MS db-lib source compatibility: yes
        Sybase binary compatibility: yes
                      Thread safety: yes
                      iconv library: yes
                        TDS version: 4.2
                              iODBC: no
                           unixodbc: yes
              SSPI "trusted" logins: no
                           Kerberos: yes

========

tsql -H testDSN -pXXXX -U'testuser '-P'testpass'

locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF8"
20Error 20009 (severity 9):
        Unable to connect: Adaptive Server is unavailable or does not exist
        OS error 110, "Connection timed out"
There was a problem connecting to the server

=======

isql -v testDSN'testuser''testpass '

[S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[08S01][unixODBC][FreeTDS][SQL Server]Unable to connect: Adaptive Server is unavailable or does not exist
[ISQL]ERROR: Could not SQLConnect

======== osql -S testDSN -U'testuser '-P'testpass'.。

Configuration looks OK.  Connection details:

                   DSN: testDSN
              odbc.ini: /etc/odbc.ini
                Driver: /usr/lib64/libtdsodbc.so
       Server hostname: winsrv106.pleskdns.co.uk
               Address: x.x.x.x

Attempting connection as testuser ...
+ isql testDSN testuser 'testpass' -v
[S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[08S01][unixODBC][FreeTDS][SQL Server]Unable to connect: Adaptive Server is unavailable or does not exist
[ISQL]ERROR: Could not SQLConnect
net.c:205:FAILED Connecting to x.x.x.x port XXXX (TDS version 7.1)

========

もっとfreetds.log

log.c:196:Starting log file for FreeTDS 0.91
        on 2014-04-10 15:33:03 with debug flags 0x4fff.
iconv.c:330:tds_iconv_open(0x7233e0, UTF8)
iconv.c:187:local name for ISO-8859-1 is ISO-8859-1
iconv.c:187:local name for UTF-8 is UTF-8
iconv.c:187:local name for UCS-2LE is UCS-2LE
iconv.c:187:local name for UCS-2BE is UCS-2BE
iconv.c:349:setting up conversions for client charset "UTF8"
iconv.c:351:preparing iconv for "UTF8" <-> "UCS-2LE" conversion
iconv.c:391:preparing iconv for "ISO-8859-1" <-> "UCS-2LE" conversion
iconv.c:394:tds_iconv_open: done
net.c:205:Connecting to x.x.x.x port XXXX (TDS version 7.1)
net.c:270:tds_open_socket: connect(2) returned "Operation now in progress"
net.c:306:getsockopt(2) reported: Connection timed out
net.c:316:tds_open_socket() failed
util.c:331:tdserror(0x723140, 0x7233e0, 20009, 110)
util.c:361:tdserror: client library returned TDS_INT_CANCEL(2)
util.c:384:tdserror: returning TDS_INT_CANCEL(2)
mem.c:615:tds_free_all_results()

========

telnet x.x.x.x

Trying x.x.x.x... 
telnet: connect to address x.x.x.x: 
Connection timed out
7
user247497

同じ問題が発生し、カスタムポートを使用して解決しました:freetds.confのport = XXXXXこのポートは、SQLServer構成管理で構成する必要があります

SQLServerネットワーク構成-> TCP/IP(有効)-> IPアドレス-> IPAll-> TCP動的ポート

https://msdn.Microsoft.com/en-us/library/ms177440.aspx

5
Dimitris

VirtualBoxでMSWindowsを実行しています。

したがって、MacホストからMS SQLServerにアクセスするには、次のことを行う必要があります。

  • VirtualBox>デバイス>ネットワーク>ネットワーク設定>詳細にポート転送エントリを追加します

  • MSコントロールパネル> Windowsファイアウォール>詳細設定>インバウンドルールでポート1444を開きます

  • SQLServer構成マネージャー> SQLServerサービスでSQLServerブラウザーを起動します

  • SQLServer構成マネージャー>プロトコルでTCP)を有効にする

  • SQL Server ConfigurationManagerのTCPAllのTCPポートを1444に設定>プロトコル> TCP/IP>プロパティ...

Set TCP Port to 1444

MS SQL Serverは、ポート1444でリッスンするように構成されていることに注意してください。

2
l3x

Pymssqlを初めて使用したときにこのエラーが発生しました。 SQLServerのローカルインストールのネットワークプロトコルの1つとしてTCP/IPをオンにする必要がありました。

0
MrTelly

ローカルマシン上のSQLServer2008データベースにFreeTDSをインターフェイスするCygwin64インストールでの私と同様の解決策。 MSSQLServerサービスのTCP/IPプロトコルを有効にし、解決するためにサービスを再起動する必要がありました。

freetds.logトレースのアクティブ化により、解決策が見つかりました(ログサンプルは次のとおりです)。

11:16:13.960012 10688 (log.c:167):Starting log file for FreeTDS 0.95.69
    on 2015-11-26 11:16:13 with debug flags 0xffff.<br>
11:16:13.960012 10688 (iconv.c:328):tds_iconv_open(0x60004b500, UTF-8)<br>
11:16:13.960012 10688 (iconv.c:187):local name for ISO-8859-1 is ISO-8859-1<br>
11:16:13.960012 10688 (iconv.c:187):local name for UTF-8 is UTF-8<br>
11:16:13.960012 10688 (iconv.c:187):local name for UCS-2LE is UCS-2LE<br>
11:16:13.960012 10688 (iconv.c:187):local name for UCS-2BE is UCS-2BE<br>
11:16:13.960012 10688 (iconv.c:346):setting up conversions for client charset "UTF-8"<br>
11:16:13.960012 10688 (iconv.c:348):preparing iconv for "UTF-8" <-> "UCS-2LE" conversion<br>
11:16:13.960012 10688 (iconv.c:395):preparing iconv for "ISO-8859-1" <-> "UCS-2LE" conversion<br>
11:16:13.960012 10688 (iconv.c:400):tds_iconv_open: done<br>
11:16:13.960012 10688 (net.c:202):Connecting to ?.?.?.? port 1433 (TDS version 7.3)<br><br>
11:16:13.963012 10688 (net.c:274):tds_open_socket: connect(2) returned "Operation now in progress"<br>
11:16:14.963069 10688 (net.c:309):getsockopt(2) reported: Connection refused<br>
11:16:14.963069 10688 (net.c:319):tds_open_socket() failed<br>
11:16:14.963069 10688 (util.c:322):tdserror(0x600049ad0, 0x60004b500, 20009, 111)<br>
11:16:14.963069 10688 (odbc.c:2343):msgno 20009 20003<br>
11:16:14.963069 10688 (util.c:352):tdserror: client library returned TDS_INT_CANCEL(2)<br>
11:16:14.963069 10688 (util.c:375):tdserror: returning TDS_INT_CANCEL(2)<br>
11:16:14.963069 10688 (mem.c:648):tds_free_all_results()<br>
11:16:14.964069 10688 (error.c:414):odbc_errs_add: "Unable to connect to data source"<br>
11:16:14.964069 10688 (error_export.h:23):SQLError(0x0, 0x600049b70, 0x0, 0x22ba50, 0x22ba4c, 0x22c540, 513, 0x22ba46)<br>
11:16:14.964069 10688 (error.c:565):SQLGetDiagRec: "[FreeTDS][SQL Server]Unable to connect: Adaptive Server is unavailable or does not exist"<br>
11:16:14.964069 10688 (error_export.h:23):SQLError(0x0, 0x600049b70, 0x0, 0x22ba50, 0x22ba4c, 0x22c540, 513, 0x22ba46)<br>
11:16:14.964069 10688 (error.c:565):SQLGetDiagRec: "[FreeTDS][SQL Server]Unable to connect to data source"<br>
0
TonyD