2016-12-01 119 views
2

我在Windows Server 2008上運行,我想將我的應用程序連接到本地SQL Server數據庫。使用Windows身份驗證連接到本地SQL Server數據庫的連接字符串

我已閱讀本:https://codedark.xyz/blog/connecting-to-ms-sql-server-with-knex

我已經啓用了TCP/IP連接到服務器以及SQL Server的默認端口1433。然後我重新啓動了服務器實例。

我試圖使用Windows身份驗證和我的連接字符串連接看起來是這樣的:

mssql: { 
client : "mssql", 
connection: { 
    server : "localhost", 
    user : "windowsusername", 
    password : "windowspassword", 
    options: { 
    port: 1433, 
    database : "mydb", 
    encrypt: true 
    } 
}, 
} 

我得到這個錯誤:

用戶登錄失敗 'windowsuser'

我的問題:是否可以使用Windows身份驗證連接到本地SQL Server數據庫?如果是的話,哪個是正確的憑證?

回答

0

如果您希望使用Windows身份驗證,這我會建議,然後刪除該用戶名和密碼信息,並嘗試這個辦法:

Integrated Security: "SSPI" 

根據您的設置,使用Windows身份驗證,除非你能也困難重重指定連接字符串爲實際字符串而不是對象。

查看此問題以獲取更多信息Stack Reference

相關問題