diff --git a/.devcontainer/.mssql.json b/.devcontainer/.mssql.json index 59d02fef..2a12dc64 100644 --- a/.devcontainer/.mssql.json +++ b/.devcontainer/.mssql.json @@ -7,6 +7,7 @@ "requestTimeout": 30000, "options": { "abortTransactionOnError": true, - "encrypt": false + "encrypt": false, + "columnEncryption": false } } diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 8bfe5d7f..466fbd3d 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -145,6 +145,7 @@ jobs: sqlserver-version: ${{ matrix.sqlserver }} sa-password: ${{ env.MSSQL_PASSWORD }} native-client-version: 11 + odbc-version: 17 - name: Store test config shell: bash run: echo "{\"user\":\"sa\",\"password\":\"$MSSQL_PASSWORD\",\"server\":\"localhost\",\"port\":1433,\"database\":\"master\",\"requestTimeout\":30000,\"options\":{\"abortTransactionOnError\":true,\"encrypt\":false}}" > ./test/.mssql.json diff --git a/lib/msnodesqlv8/connection-pool.js b/lib/msnodesqlv8/connection-pool.js index 09b367f4..5a75a1a2 100644 --- a/lib/msnodesqlv8/connection-pool.js +++ b/lib/msnodesqlv8/connection-pool.js @@ -23,13 +23,14 @@ class ConnectionPool extends BaseConnectionPool { if (!this.config.connectionString) { cfg.conn_str = buildConnectionString({ - Driver: CONNECTION_DRIVER, + Driver: this.config.driver ?? CONNECTION_DRIVER, Server: this.config.options.instanceName ? `${this.config.server}\\${this.config.options.instanceName}` : `${this.config.server},${this.config.port}`, Database: this.config.database, Uid: this.config.user, Pwd: this.config.password, Trusted_Connection: !!this.config.options.trustedConnection, - Encrypt: !!this.config.options.encrypt + Encrypt: !!this.config.options.encrypt, + ColumnEncryption: this.config.columnEncryption ?? 'Disabled' }) } diff --git a/test/common/tests.js b/test/common/tests.js index 849e1fd1..e30f7f40 100644 --- a/test/common/tests.js +++ b/test/common/tests.js @@ -1318,6 +1318,7 @@ module.exports = (sql, driver) => { 'login failed' (done, message) { const config = readConfig() config.user = '__notexistinguser__' + config.options.trustedConnection = false // eslint-disable-next-line no-new const conn = new sql.ConnectionPool(config, (err) => { diff --git a/test/msnodesqlv8/msnodesqlv8.js b/test/msnodesqlv8/msnodesqlv8.js index d42e7b67..95296253 100644 --- a/test/msnodesqlv8/msnodesqlv8.js +++ b/test/msnodesqlv8/msnodesqlv8.js @@ -93,6 +93,11 @@ describe('msnodesqlv8', function () { it('request timeout', done => TESTS['request timeout'](done)) it('dataLength type correction', done => TESTS['dataLength type correction'](done)) it('chunked xml support', done => TESTS['chunked xml support'](done)) + it('force ODBC connection healthy works', (done) => { + const cfg = config() + cfg.options.driver = 'ODBC Driver 17 for SQL Server' + TESTS['connection healthy works'](cfg, done) + }) after(() => sql.close()) })