Here’s the node JS code I’m using:
const { createPool } = require('mysql');
const pool = createPool({
host: "localhost",
user: "TEST",
port: 3306,
password: "TEST",
database: "TestDB",
connectionLimit: 10
});
pool.query(`select * from dbo.TestPlans`, function(err, result, fields) {
if (err) {
return console.log(err);
}
return console.log(result);
});
Here’s what I’ve done so far:
- I’ve enabled TCP/IP in my SQL server manager
- Manually set the TCP Port to 3306 in my SQL server manager
- Ensured that “SQL Server and Windows Authentication mode” is enabled through Microsoft SQL Server Management Studio
- Ensured that the login “TEST” is capable of logging in through Microsoft SQL Server Management Studio with the “SQL Server Authentication” Authentication type
Changing the port number will give me a different error:
And using the first example from w3schools results in the program hanging.
I’m unsure what to look at at this point, is there a configuration I need to change in my SQL database to enable connections via node?