设置freeTsd时遇到问题

时间:2015-08-12 13:29:51

标签: php sql-server odbc freetds

我正在尝试通过运行ubuntu 14.04 LTS的虚拟机配置与MS Sql Server的连接。这些是我的配置文件:

ODBC.INI

[scr]
Driver      = FreeTDS
Description = Scr
ServerName  = scr
TDS Version = 9.0

ODBCINST.INI

[FreeTDS]
Description = FreeTDS Driver v0.91
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
fileusage=1
dontdlclose=1
UsageCount=1

freetds.conf

#   $Id: freetds.conf,v 1.12 2007/12/25 06:02:36 jklowden Exp $
#
# 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 = 7.1

        # 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

# Server scr
[scr]
        host = examplentmachine.domain.com
        port = 1433
        tds version = 9.0
        client charset = UTF-8
        text size = 20971520

当我跑步时:

tsql -H scr -p 1433 -U exampleuser

它返回:

locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
Msg 40532 (severity 20, state 1) from scr:
    "Cannot open server "scr" requested by the login.  The login failed."
Error 20002 (severity 9):
    Adaptive Server connection failed
There was a problem connecting to the server

运行isql命令也会返回错误:     isql -v scr

[S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[01000][unixODBC][FreeTDS][SQL Server]Adaptive Server connection failed
[ISQL]ERROR: Could not SQLConnect

有人知道发生了什么吗?

0 个答案:

没有答案