Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in connecting to database when using msnodesqlv8 driver and password has special character in it #1476

Closed
abhku opened this issue Mar 15, 2023 · 5 comments · Fixed by #1479
Labels

Comments

@abhku
Copy link

abhku commented Mar 15, 2023

I am using mssql with msnodesqlv8. I have database with password containing ; in it e.g. -'%;0&<,4#l} . SQL server allows password like this but when we use this kind of password the ODBC connection string doesn't works and gives Error : Login failed for user 'xxxx'.,Error: [Microsoft][SQL Server Native Client 11.0]Invalid connection string attribute

Expected behaviour:

Connection should work

Actual behaviour:

Connection is not working

Configuration:

{
  options: {
    instanceName: undefined,
    trustServerCertificate: false,
    abortTransactionOnError: true
  },
  pool: { max: 100, min: 1, idleTimeoutMillis: 50 },
  port: 1433,
  server: 'xxxxxxx',
  database: 'xxxxx',
  domain: undefined,
  user: 'xxxxx',
  password: "-'%;0&<,4#l}",
  connectionTimeout: 30000,
  requestTimeout: 120000
}

Software versions

  • NodeJS: 16
  • node-mssql: "^9.0.1"
  • msnodesqlv8": "^3.0.1",
  • SQL Server: Azure SQL
@abhku
Copy link
Author

abhku commented Mar 15, 2023

The password should be wrapped within {} and escape } with }}

@dhensby
Copy link
Collaborator

dhensby commented Mar 16, 2023

Interesting, that's a good catch - the way msnodesqlv8 works is that we provide an SQL connection string to it, and we should be escaping special chars when we construct that string which, clearly, is not happening...

@dhensby
Copy link
Collaborator

dhensby commented Mar 16, 2023

I've tried to fix this in #1479 - can you take a look and let me know if it fixes your problem

@abhku
Copy link
Author

abhku commented Mar 20, 2023

Yes, this fixes the problem

@github-actions
Copy link

github-actions bot commented Aug 8, 2023

🎉 This issue has been resolved in version 9.1.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants