gpt4 book ai didi

sql-server - 连接到 Linux 上的 SQL Server : tsql works; isql cannot log in

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:57:02 25 4
gpt4 key购买 nike

我正在尝试使用 Linux 建立与 SQL 服务器实例的连接。我的 FreeTDS 设置似乎可以工作,但我的 unixODBC 设置不起作用。

这是我使用 tsql 访问数据库时发生的情况:

tsql -S STCONNSQLDEV\\RscSwitchboard -U sa_RSCSWITCHBOARD -P password
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"

这是我使用 isql 时发生的情况:

isql RscSwitchboard sa_RSCSWITCHBOARD password -v
[S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[37000][unixODBC][FreeTDS][SQL Server]Login failed for user 'sa_RSCSWITCHBOARD'.
[ISQL]ERROR: Could not SQLConnect

我的/etc/freetds/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 = 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

[STCONNSQLDEV\\RscSwitchboard]
host = 192.168.15.12
port = 1433
tds version = 8.0
client charset = UTF-8

我的/etc/odbc.ini:

[RscSwitchboard]
Driver = FreeTDS
Description = ODBC connection via FreeTDS
Trace = Yes
TraceFile = /tmp/rscswitchboard
servername = STCONNSQLDEV\\RscSwitchboard
Database = RscSwitchboard
Port = 1433

我的/etc/odbcinst.ini:

[FreeTDS]
Description = tdsodbc
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so

[ODBC]
DEBUG=1
Trace = Yes
TraceFile = /tmp/rscswitchboard

我的跟踪文件:

[ODBC][5002][1406656337.564089][__handles.c][450]
Exit:[SQL_SUCCESS]
Environment = 0x14b4750
[ODBC][5002][1406656337.564197][SQLAllocHandle.c][364]
Entry:
Handle Type = 2
Input Handle = 0x14b4750
[ODBC][5002][1406656337.564254][SQLAllocHandle.c][482]
Exit:[SQL_SUCCESS]
Output Handle = 0x14b5080
[ODBC][5002][1406656337.564321][SQLConnect.c][3615]
Entry:
Connection = 0x14b5080
Server Name = [RscSwitchboard][length = 14 (SQL_NTS)]
User Name = [sa_RSCSWITCHBOARD][length = 17 (SQL_NTS)]
Authentication = [********][length = 8 (SQL_NTS)]
UNICODE Using encoding ASCII 'ISO8859-1' and UNICODE 'UCS-2LE'

DIAG [42000] [FreeTDS][SQL Server]Login failed for user 'sa_RSCSWITCHBOARD'.

DIAG [S1000] [FreeTDS][SQL Server]Unable to connect to data source

[ODBC][5002][1406656337.828774][SQLConnect.c][3983]
Exit:[SQL_ERROR]
[ODBC][5002][1406656337.828841][SQLError.c][430]
Entry:
Connection = 0x14b5080
SQLState = 0x7fff8cbb4b10
Native = 0x7fff8cbb4b0c
Message Text = 0x7fff8cbb4b20
Buffer Length = 500
Text Len Ptr = 0x7fff8cbb4b0a
[ODBC][5002][1406656337.828912][SQLError.c][467]
Exit:[SQL_SUCCESS]
SQLState = S1000
Native = 0x7fff8cbb4b0c -> 0
Message Text = [[unixODBC][FreeTDS][SQL Server]Unable to connect to data source]
[ODBC][5002][1406656337.829032][SQLError.c][430]
Entry:
Connection = 0x14b5080
SQLState = 0x7fff8cbb4b10
Native = 0x7fff8cbb4b0c
Message Text = 0x7fff8cbb4b20
Buffer Length = 500
Text Len Ptr = 0x7fff8cbb4b0a
[ODBC][5002][1406656337.829098][SQLError.c][467]
Exit:[SQL_SUCCESS]
SQLState = 37000
Native = 0x7fff8cbb4b0c -> 18456
Message Text = [[unixODBC][FreeTDS][SQL Server]Login failed for user 'sa_RSCSWITCHBOARD'.]
[ODBC][5002][1406656337.829179][SQLError.c][430]
Entry:
Connection = 0x14b5080
SQLState = 0x7fff8cbb4b10
Native = 0x7fff8cbb4b0c
Message Text = 0x7fff8cbb4b20
Buffer Length = 500
Text Len Ptr = 0x7fff8cbb4b0a
[ODBC][5002][1406656337.829234][SQLError.c][467]
Exit:[SQL_NO_DATA]
[ODBC][5002][1406656337.829284][SQLError.c][510]
Entry:
Environment = 0x14b4750
SQLState = 0x7fff8cbb4b10
Native = 0x7fff8cbb4b0c
Message Text = 0x7fff8cbb4b20
Buffer Length = 500
Text Len Ptr = 0x7fff8cbb4b0a
[ODBC][5002][1406656337.829332][SQLError.c][547]
Exit:[SQL_NO_DATA]
[ODBC][5002][1406656337.829423][SQLFreeHandle.c][279]
Entry:
Handle Type = 2
Input Handle = 0x14b5080
[ODBC][5002][1406656337.829477][SQLFreeHandle.c][330]
Exit:[SQL_SUCCESS]
[ODBC][5002][1406656337.829540][SQLFreeHandle.c][212]
Entry:
Handle Type = 1
Input Handle = 0x14b4750

我使用的是 Ubuntu 14.04 x86_64。有人有什么建议吗?

最佳答案

我会尝试以下方法:

== freetds.conf

[global]
charset = UTF-8
client charset = UTF-8
timeout = 10
connect timeout = 10

[server_a]
host = 192.168.15.12
port = 1433

==/etc/odbc.ini

[config_a]
Driver = FreeTDS
Servername = server_a
Database = RscSwitchboard
Port = 1433

$ isql -v config_a sa_RSCSSWITCHBOARD 密码

如果这不能解决问题,那么试试

tds version = 7.3

关于sql-server - 连接到 Linux 上的 SQL Server : tsql works; isql cannot log in,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25021978/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com