22

FreeTDS と unixODBC を使用して、Ubuntu 12.04 Web サーバーから MSSQL サーバーへの接続を実行しようとしています。

tsqlを使用して、サーバーに接続できます

~$ tsql -S dbs3 -U <username> -P <password>

問題ありません。

ただし、isql に接続しようとすると、次のエラー メッセージが表示されます。

~$ isql -v database3 <username> <password>
[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

[database3]
Driver=FreeTDS
TDS_Version=8.0
Servername=dbs3
Port=1433
Database=benchmark_res

odbcinst.ini

[FreeTDS]
Description=FreeTDS v0.91
Driver=/usr/local/lib/libtdsodbc.so
Setup=/usr/local/lib/libtdsS.so
Trace=Yes
TraceFile=/tmp/freetds.log
ForceTrave=Yes
UsageCount=1

freetds.conf

# This file is installed by FreeTDS if no file by the same
# name is found in the installation directory.
#
# For information about the layout of this file and its settings,
# see the freetds.conf manpage "man freetds.conf".

# Global settings are overridden by those in a database
# server specific section
[global]
    # TDS protocol version
;   tds version = 4.2

    # Whether to write a TDSDUMP file for diagnostic purposes
    # (setting this to /tmp is insecure on a multi-user system)
;   dump file = /tmp/freetds.log
;   debug flags = 0xffff

    # Command and connection timeouts
;   timeout = 10
;   connect timeout = 10

    # If you get out-of-memory errors, it may mean that your client
    # is trying to allocate a huge buffer for a TEXT field.
    # Try setting 'text size' to a more reasonable limit
    text size = 64512

# A typical Sybase server
[egServer50]
    host = symachine.domain.com
    port = 5000
    tds version = 5.0

# A typical Microsoft server
[egServer70]
    host = ntmachine.domain.com
    port = 1433
    tds version = 7.0

[dbs3]
    host = <server-ip>
    port = 1433
    tds version = 8.0

インストールガイドに従いました 1.ここと 2.ここ

isql が正しく接続されないのはなぜですか?
私の推測では、間違いは非常に明白ですが、私は愚かすぎてそれを見ることができません:D

4

3 に答える 3

13

問題は odbc.ini のこの行でした

[database3] must be [dbs3] in your case.

この問題も抱えている人は、

ServerName  = *Points to the name of the server configured in freetds.conf*
于 2014-05-23T22:46:08.657 に答える
1

odbc がデータソースを見つけられない場合は、間違ったデータソースを提供していることを意味します

dbs3odbc.ini にそれがない場合、接続しようとしている可能性があります。

[database3]ODBC用に接続する必要があります

isql -v database3 <username> <password>
于 2013-08-14T15:52:40.167 に答える