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

Sequelize Connection string issues when there is no instanceName #17

Open
jurmb84 opened this issue Feb 6, 2023 · 0 comments
Open

Sequelize Connection string issues when there is no instanceName #17

jurmb84 opened this issue Feb 6, 2023 · 0 comments

Comments

@jurmb84
Copy link

jurmb84 commented Feb 6, 2023

My companies SQL Server is using the default instance name MSSQLSERVER.
In reviewing an issue I had connecting, I looking in msnodesqlv8/lib/sequelize/connection.js

If I set the instanceName option to MSSQLSERVER it is changed on line 58 to ''. However the connection string builder starting on line 60 is listed as:

config.connectionString = (config.driver ? `Driver={${config.driver}};` : '') +
        `Server=${config.server ? config.server : 'localhost'}\\${config.instanceName};` +
        (config.database ? `Database=${config.database};` : '') +
        (config.trustedConnection ? 'Trusted_Connection=yes;' : `Uid=${config.userName || ''};Pwd=${config.password || ''};`)

However, without an instance name the server is listed as Server=(server)\\; That is incorrect and causes issues. Also, encryption is not built into the connection string builder. I have changed it to the following and it is now working correctly.

config.connectionString = (config.driver ? `Driver={${config.driver}};` : '') +
        `Server=${config.server ? config.server : 'localhost'}` +
        (config.instanceName ? `\\${config.instanceName};` : ';') +
        (config.database ? `Database=${config.database};` : '') +
        (config.trustedConnection ? 'Trusted_Connection=yes;' : `Uid=${config.userName || ''};Pwd=${config.password || ''};`) +
        `Encrypt=${config.encrypt ? 'yes' : 'no'};`

Thank you for your attn to this matter.

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

No branches or pull requests

1 participant