简体   繁体   中英

Connection string to connect to a local SQL Server database using windows authentication

I m operating on Windows Server 2008 and I want to connect my application to a local SQL Server database .

I have read this: https://codedark.xyz/blog/connecting-to-ms-sql-server-with-knex

I have enabled TCP/IP connections to the server as well as default port 1433 for SQL Server. I then restarted the server instance.

I'm trying to connect with Windows authentication and my connection string looks like this :

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

I get this error :

Login failed for user 'windowsuser'

My question: is it possible to connect to a local SQL Server database using Windows authentication? And if yes, which are the right credentials?

If you wish to use windows authentication, which I would recommend, then remove the user and password information and try this:

Integrated Security: "SSPI"

Depending on your set up, using windows auth could prove difficult unless you can specify the connection string as an actual string and not an object.

See this question for additional information Stack Reference

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM