I am new to SQL Server and i am trying to establish connection between Nodejs and SQL Server which is hosted on my Local Machine which is authenticated using Windows Authentication
Here is my Connection Configurations
const sql = require("mssql");
require("msnodesqlv8");
const conn = new sql.ConnectionPool({
database: "ApplicantsData",
server: "localhost",
driver: "msnodesqlv8",
options: {
trustedConnection: true,
TrustServerCertificate:true
}
});
conn.connect().then(() => {
//check
});
whenever i try to connect i got an error of
Failed to connect to localhost:1433 - certificate is not yet valid
i have searched for this type of error and i ensured that:
- TCP/IP enabled using SQL Server Configurations
- Enabled SQL Server Browsing
any solutions/fixes?
1条答案
按热度按时间hmae6n7t1#
This is a problem with your current date and time of your IoT, where the nodejs is running(assume linux). set the date and time using below command.
date MMDDHHMMYYYY
for example
date 062611102023
then set the hwclock with
hwclock --systohc
run the .js again. enjoy