FreeTDS - tsql connects, isql fails

2020-07-11 04:50发布

问题:

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.

freetds.conf

text size = 64512

[SQLEXPRESS]
host = 192.168.163.1
port = 1433
tds version = 7.0

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 -S SQLEXPRESS  -U sa
#success

isql:

isql SQLEXPRESS sa test1234 -v
[S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[ISQL]ERROR: Could not SQLConnect

回答1:

The issue was this line in odbc.ini

Servername = 192.168.163.1

It should have been SQLEXPRESS which I think points to the name of the server configured in freetds.conf