Linux FreeTDS - tsql 连接,isql 失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8010361/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
FreeTDS - tsql connects, isql fails
提问by recursive_acronym
I'm trying to connect to a database on my host machine (windows xp, sql server 05). My guest machine is Ubuntu 10.04. I can connect and execute commands with tsql, but isql fails. Below are my config files and error messages.
我正在尝试连接到我的主机(windows xp、sql server 05)上的数据库。我的来宾机器是 Ubuntu 10.04。我可以使用 tsql 连接和执行命令,但 isql 失败。以下是我的配置文件和错误消息。
freetds.conf
freetds.conf
text size = 64512
[SQLEXPRESS]
host = 192.168.163.1
port = 1433
tds version = 7.0
odbcinst.ini
odbcinst.ini
[FreeTDS]
Description = TDS driver (Sybase/MS SQL)
Driver = /usr/lib/odbc/libtdsodbc.so
Setup = /usr/lib/odbc/libtdsS.so
CPTimeout =
CPReuse =
FileUsage = 1
odbc.ini
数据库配置文件
[SQLEXPRESS]
Driver = FreeTDS
Description = ODBC connection via FreeTDS
Trace = No
Servername = 192.168.163.1
Database = SCOPE_Peel
Port = 1433
UID = sa
PWD = test1234
ReadOnly = No
tsql:
tsql:
tsql -S SQLEXPRESS -U sa
#success
isql:
sql:
isql SQLEXPRESS sa test1234 -v
[S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[ISQL]ERROR: Could not SQLConnect
采纳答案by recursive_acronym
The issue was this line in odbc.ini
问题是 odbc.ini 中的这一行
Servername = 192.168.163.1
Servername = 192.168.163.1
It should have been SQLEXPRESS which I think points to the name of the server configured in freetds.conf
它应该是 SQLEXPRESS,我认为它指向 freetds.conf 中配置的服务器的名称