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

request.transformIntoExecuteSqlRpc() is not a function #63

Open
JaggieG opened this issue Nov 19, 2021 · 6 comments
Open

request.transformIntoExecuteSqlRpc() is not a function #63

JaggieG opened this issue Nov 19, 2021 · 6 comments

Comments

@JaggieG
Copy link

JaggieG commented Nov 19, 2021

  • 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

@ThomasHillLF
Copy link

Looks like it was removed in v14.3.0 in this commit.

@danielkboyer
Copy link

Getting the same error. Is there a fix for this?

@700software
Copy link

Can anyone confirm whether this is still an issue in tedious-connection-pool2@2.1.0?

@Hu1a1a
Copy link

Hu1a1a commented Apr 17, 2024

Hope it to have fixed.

@Alice3105
Copy link

I still have the issue. The connectionPool is established earlier with a separate connect() function.

image

@Alice3105
Copy link

I figured out the solution. Make sure you import from 'tedious-connection-pool/node_modules/tedious' instead of just tedious. I'm using TypeScript

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

6 participants