的SQL Server ODBC驱动程序的Linux用户名“”
问题描述:
我安装的Linux版本的Microsoft SQL Server ODBC驱动程序13的SQL Server ODBC驱动程序的Linux用户名“”
我可以用用户名密码登录命令行,但不与内ODBC.INI
的用户名和密码例如
curl https://packages.microsoft.com/config/rhel/6/prod.repo > /etc/yum.repos.d/mssql-release.repo yum install msodbcsql mssql-tools
[[email protected] etc]# cat odbc.ini
[MY_ODBC_DSN]
Driver = ODBC Driver 13 for SQL Server
Server = tcp:10.10.10.1,1433
Database = demo
UID = user1
PWD = password
不工作
isql -v MY_ODBC_DSN user1 password
不义和k
isql -v MY_ODBC_DSN
[28000][unixODBC][Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user ''.
[ISQL]ERROR: Could not SQLConnect
答
@Patrick,你不能从odbc.ini读取用户名和密码。我用sqlcmd试过这个,这是我如何验证它。
sudo su
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-tools.list
exit
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install mssql-tools unixodbc-dev
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
ODBCINST.INI
[ODBC Driver 13 for SQL Server]
Description=Microsoft ODBC Driver 13 for SQL Server
Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.4.0
UsageCount=1
ODBC.INI
[TestDB]
Server=myserver
Driver=ODBC Driver 13 for SQL Server
SQLCMD
sqlcmd -D -S TestDB -U myusername -P mypassword
如果您想使用集成的身份验证,检查了这一点:
https://docs.microsoft.com/en-us/sql/connect/odbc/linux/using-integrated-authentication
刚刚获悉这是不可能 https://social.msdn.microsoft.com/Forums/sqlserver/en-US/d4eab3b3-6254-4644-a1e4-e6866f7507fd/uid-in-odbcini?forum= sqldataaccess –