Skip to content

request.transformIntoExecuteSqlRpc() is not a function #63

@JaggieG

Description

@JaggieG
  • tedious @ v14.0.0 and tedious-connection-pool @ v1.0.1
  • Connecting to an Azure DB, although I get the same issue with a standard local SQL as well.

Code

var ConnectionPool = require('tedious-connection-pool');
var Request = require('tedious').Request;

var poolConfig = {
    min: 2,
    max: 4,
    log: true
};
const connectionConfig = {
   //connection details
  };

//create the pool
var pool = new ConnectionPool(poolConfig, connectionConfig);

//acquire a connection
pool.acquire(function (err, connection) {
    if (err) {
        console.error(err);
        return;
    }
    //use the connection as normal
    var request = new Request('select 42', function(err, rowCount) {
        if (err) {
            console.error(err);
            return;
        }

        console.log('rowCount: ' + rowCount);

        //release the connection back to the pool when finished
        connection.release();
    });

    request.on('row', function(columns) {
        console.log('value: ' + columns[0].value);
    });
    
    connection.execSql(request);
});

Receive this:

connection.js:1359 - TypeError: request.transformIntoExecuteSqlRpc is not a function

If I use the tedious library without the pooling, then everything works fine

Possible Solution

I can remove the request.transformIntoExecuteSqlRpc() call in connection.js and the connection is then sent to the server, but it obviously fails as the statement is not interpreted correctly

Environment

Node.js Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions