2017-02-22 86 views
1

我安裝的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 
+2

剛剛獲悉這是不可能 https://social.msdn.microsoft.com/Forums/sqlserver/en-US/d4eab3b3-6254-4644-a1e4-e6866f7507fd/uid-in-odbcini?forum= sqldataaccess –

回答

0

@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 
相關問題