web-dev-qa-db-ja.com

「不明なホストマシン名。」 FreeBSD + unixODBC + FreeTDSで

FreeBSD10.1サーバーからMicrosoftSQL Server2012に接続する際に問題が発生しました。

FreeTDSとunixODBCをポート経由でインストールしました。 FreeTDSをunixODBCサポート付きでコンパイルしました。これは私のfreetds.confです:

[server1]
  Host = 192.168.100.147
  port = 1433
  tds version = 7.2

Tsqlの呼び出しは正常に機能します。

しかし、「osql」または「isql」を使用してodbc経由で接続しようとすると、接続が失敗し、次のエラーが発生します。

checking shared odbc libraries linked to isql for default directories...
    trying /tOH ... no
    trying /tOH ... no
    trying /tmp/sqlH ... no
    trying /tmp/sqlH ... no
    trying /usr/locH ... no
    trying /usr/locH ... no
    trying /tmp/sql.log ... no
    trying /home ... no
    trying /.odbc.ini ... no
    trying /usr/local/etc ... OK
checking odbc.ini files
    reading /root/.odbc.ini
[server1] not found in /root/.odbc.ini
    reading /usr/local/etc/odbc.ini
[server1] found in /usr/local/etc/odbc.ini
found this section:
    [server1]
      Driver = FreeTDS
      Servername = server1
looking for driver for DSN [server1] in /usr/local/etc/odbc.ini
  found driver line: "      Driver = FreeTDS"
  driver "FreeTDS" found for [server1] in odbc.ini
found driver named "FreeTDS"
"FreeTDS" is not an executable file
looking for entry named [FreeTDS] in /usr/local/etc/odbcinst.ini
  found driver line: "      Driver = /usr/local/lib/libtdsodbc.so"
  found driver /usr/local/lib/libtdsodbc.so for [FreeTDS] in odbcinst.ini
/usr/local/lib/libtdsodbc.so is an executable file
Using ODBC-Combined strategy
DSN [server1] has servername "server1" (from /usr/local/etc/odbc.ini)
cannot read "/root/.freetds.conf"
/usr/local/etc/freetds/freetds.conf is a readable file
looking for [server1] in /usr/local/etc/freetds/freetds.conf
found this section:
    [server1]
        Host = 192.168.100.147
        port = 1433
        tds version = 7.2
looking up hostname for ip address 192.168.100.147

Configuration looks OK.  Connection details:

                   DSN:    server1
              odbc.ini:    /usr/local/etc/odbc.ini
                Driver:    /usr/local/lib/libtdsodbc.so
       Server hostname:    sqlsrv01
               Address:    192.168.100.147

Attempting connection as sa ...
+ isql server1 sa foobar -v
[S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[01000][unixODBC][FreeTDS][SQL Server]Unknown Host machine name.
[ISQL]ERROR: Could not SQLConnect

これは私のodbc.iniの内容です:

[server1]
  Driver = FreeTDS
  Servername = server1

そしてこれは私のodbcinst.iniです:

[FreeTDS]
  Driver = /usr/local/lib/libtdsodbc.so
  Client Charset = UTF-8
  UsageCount = 1

正確な名前のinfodbc.iniとfreetds.confの使用に関する厳しい投稿を読みましたが、接続が失敗し続けます。

誰か助けてもらえますか?

2
stefan2342xx

私は今、自分の質問に答えることができます。

UnixODBCメーリングリストからのヒントに従って 1 私は呼び出しました

odbcinst -i -s -f /usr/local/etc/odbc.ini

そして今、私はosql経由でサーバーに接続することができます。

4
stefan2342xx