How to Connect Express.js to a Microsoft SQL Server | Step-by-Step Tutorial

preview_player
Показать описание

What You'll Learn:

- Integrating SQL Server: How to connect your Express app to a SQL Server database using the popular mssql npm package.
- Querying Data: Execute SQL queries from your Express app and handle responses.

Timestamps:
00:00 - Introduction
05:44 - Setup MS SQL Server and Database with Auth
10:00 - Create Table in Database
12:35 - Create a Database Connection file in our Express Server
23:40 - Create Query Functions to query our MS SQL Database
26:40 - Create router and test our connection and query

Resources:

Let's coooooooooode!
Рекомендации по теме
Комментарии
Автор

When creating a New Login in SQL Server, just under where you type the password are checkboxes. One of them says "User must change password on next login". That's why your passwords kept not working. Everytime you changed the password in MSSQL that box was checked. Then you need to set the Role as you did (though having a login with as few permissions as necessary is a good idea for production). Still liked your tutorial

geminix
Автор

I just subscribe to your channel, hoping to see a detailed tutorial of using macbook with docker for MSSQL and ExpressJs

josephadu
Автор

Sometimes I find myself talking to YouTube videos. lol "Uncheck Enforce Password Policy" and assign your login to your database. It's good practice to not use sa for uber access. But just making a user account doesn't automatically assign rights. Sure you can set the default database, but that is not rights. OR you can make the user to god mode (sa) but if you just went into the database and assigned db_read, etc, you'd have been fine and not had the data retrieval web app log in with all power to drop database, etc. As with the other comment, good tutorial for the mssql require. I always wondered what the back end was for ms sql dbs were in react apps. As a .net framework dev for desktop apps, it's nice to find info on how these fiddly web app things work. lol

anthonylosego
Автор

Note for future people setting this up from scratch: to be able to connect to localhost, 1433 in Sql Server you need to make sure of 2 things:
1. That you do a custom download when doing the Sql server installation, and that you check the box that says local db in the features tab.
2. That you open up the Sql configuration manager, go to SQL server network config, and turn on TCP/IP of the respective database.
Hope this helps~

YavuzBavuz
Автор

How to use MSSQL with Sequelize..? Please..!

murugeshkumar.v
Автор

following along I keep getting an error I had even before I followed along.
App listens on port 3333
Database connection failed!
ConnectionError: Failed to connect to localhost:1433 - Could not connect (sequence)
at
at Connection.onConnect
at Object.onceWrapper (node:events:622:26)
at Connection.emit (node:events:507:28)
at Connection.emit
at Connection.socketError
at
at {
code: 'ESOCKET',
originalError: ConnectionError: Failed to connect to localhost:1433 - Could not connect (sequence)
at Connection.socketError
at
at {
code: 'ESOCKET',
[cause]: AggregateError: Could not connect (sequence)
at connectInSequence
at
at async {
[errors]: [Array]
}
}
}

stNickname
join shbcf.ru