TypeError [ERR_INVALID_URL]: Invalid URL:
mssql://testuser:[email protected]\SQLEXPRESS/MyTestDB
The node package is: https://www.npmjs.com/package/mssql
As per their Quick Example
await sql.connect('mssql://username:password@localhost/database')
I am doing this
await sql.connect('mssql://testuser:[email protected]\\SQLEXPRESS/MyTestDB');
My details are:
192.168.1.70\SQLEXPRESS
I have no issues connecting from SQL Server Management Studio from a remote machine, so what is the problem in this code?
json object works, not plain string !
let config = {
user: 'testuser',
password: 'testuser',
server: '192.168.1.70\\SQLEXPRESS',
database: 'MyTestDB'
}
Update: From a github issue it became clearer the Quick Example format is a Uri, not a connection string.
So instead of:
'mssql://testuser:[email protected]\\SQLEXPRESS/MyTestDB'
I should use the below, which I've since confirmed also works!
'mssql://testuser:[email protected]/SQLEXPRESS/MyTestDB'