Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

Failed to connect to localhost:1433 - self signed certificate

const config = {
  port: parseInt(process.env.DB_PORT, 10),
  server: process.env.DB_HOST,
  user: process.env.DB_USER,
  password: process.env.DB_PASS,
  database: process.env.DB_Database,
  stream: false,
  options: {
    trustedConnection: true,
    encrypt: true,
    enableArithAbort: true,
    trustServerCertificate: false,

  },
}

sql.connect(config).then(pool => {
  if (pool.connecting) {
    console.log('Connecting to the database...')
  }
  if (pool.connected) {
    console.log('Connected to SQL Server')
  }
})
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Failed #connect #signed #certificate
ADD COMMENT
Topic
Name
5+1 =