Skip to content

Problem with concurrent connections #5

Closed
@patriksimek

Description

@patriksimek

Hi, first of all thanks for your efforts on making this lib up to date with latest node releases. I'm in the process of implementing support into node-mssql and during that I found some glitches. I'm going to create a separate issues for each of them.

var msnodesql = require('msnodesqlv8');
msnodesql.open("Driver={SQL Server Native Client 11.0};Server=localhost;Database=xsp;Uid=xsp_test;Pwd=...;Trusted_Connection=No;", function(err, conn1) {
    if (err) return console.error(err);

    msnodesql.open("Driver={SQL Server Native Client 11.0};Server=localhost;Database=xsp;Uid=xsp_test2;Pwd=...;Trusted_Connection=No;", function(err, conn2) {
        if (err) return console.error(err);

        conn1.query("select @@SPID as id, CURRENT_USER as name", function(err, res) {
            if (err) return console.error(err);

            console.log('CONN1', res);
        });

        conn2.query("select @@SPID as id, CURRENT_USER as name", function(err, res) {
            if (err) return console.error(err);

            console.log('CONN2', res);
        });
    });
});

Got:

CONN1 [ { id: 56, name: 'xsp_test2' } ]
CONN2 [ { id: 56, name: 'xsp_test2' } ]

Expected:

CONN1 [ { id: 56, name: 'xsp_test' } ]
CONN2 [ { id: 57, name: 'xsp_test2' } ]

This problem was not present in original msnodesql.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions