Giter Site home page Giter Site logo

Comments (5)

pekim avatar pekim commented on June 5, 2024

I took your code, threw in a couple of console.log calls, and found no problems. It connected, executed the statement, and gave me the answer to life, the universe and everything.

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

var tediousConfig = {
    "userName": "test",
    "password": "test",
    "server": "192.168.1.212",
    "options": {
        "database": "test"
    }
};

var pool = new ConnectionPool({max: 10, log: true}, tediousConfig);

pool.requestConnection(function (err, connection) {
        console.log('connect', err);
        if(!err) {
            var request = new Request('select 42', function(err, rowCount) {
                    assert.strictEqual(rowCount, 1);

                    // Release the connection back to the pool.                                                                                                
                    connection.close();
                    console.log('closed');
            });

            request.on('row', function(columns) {
                    console.log(columns[0].value);
                    assert.strictEqual(columns[0].value, 42);
                });

            connection.on('connect', function(err) {
                    connection.execSql(request);
                });
        }
});

This was with tedious and tedious-connection-pool freshly installed by npm.

So I'm not sure why it's not working for you.

from tedious-connection-pool.

nicktackes avatar nicktackes commented on June 5, 2024

thanks Mike.
It appears my problem is somewhere within my configuration of freeTDS or
iODBC... i'm still attempting to diagnose at those levels. I appreciate
you having a look

Nick Tackes

On Mon, Nov 26, 2012 at 3:27 PM, Mike D Pilsbury
[email protected]:

I took your code, threw in a couple of console.log calls, and found no
problems. It connected, executed the statement, and gave me the answer to
life, the universe and everything.

var assert = require('assert');var ConnectionPool = require('tedious-connection-pool');var Request = require('tedious').Request;
var tediousConfig = {
"userName": "test",
"password": "test",
"server": "192.168.1.212",
"options": {
"database": "test"
}};
var pool = new ConnectionPool({max: 10, log: true}, tediousConfig);
pool.requestConnection(function (err, connection) {
console.log('connect', err);
if(!err) {
var request = new Request('select 42', function(err, rowCount) {
assert.strictEqual(rowCount, 1);

                // Release the connection back to the pool.
                connection.close();
                console.log('closed');
        });

        request.on('row', function(columns) {
                console.log(columns[0].value);
                assert.strictEqual(columns[0].value, 42);
            });

        connection.on('connect', function(err) {
                connection.execSql(request);
            });
    }});

So I'm not sure why it's not working for you.


Reply to this email directly or view it on GitHubhttps://github.com//issues/3#issuecomment-10739344.

from tedious-connection-pool.

nicktackes avatar nicktackes commented on June 5, 2024

thank you again Mike. My issue had to do with my sql server network configuration not having tcp/ip enabled for my sql server instance.

from tedious-connection-pool.

pekim avatar pekim commented on June 5, 2024

I'm glad that you've got it sorted.

from tedious-connection-pool.

nicktackes avatar nicktackes commented on June 5, 2024

Hello Mike,

thanks for your great module. I am using Tedious as well as the connection
pool module that you have on github. I was curious if you could provide a
bit of insight on canceling a long running process.

With a process Id i could just use the sp_CancelProcess. Would you
recommend that approach? Has the process id been obtained when a request
or execute sql has been issued?

thanks for any insight,

Nick

On Mon, Nov 26, 2012 at 3:27 PM, Mike D Pilsbury
[email protected]:

I took your code, threw in a couple of console.log calls, and found no
problems. It connected, executed the statement, and gave me the answer to
life, the universe and everything.

var assert = require('assert');var ConnectionPool = require('tedious-connection-pool');var Request = require('tedious').Request;
var tediousConfig = {
"userName": "test",
"password": "test",
"server": "192.168.1.212",
"options": {
"database": "test"
}};
var pool = new ConnectionPool({max: 10, log: true}, tediousConfig);
pool.requestConnection(function (err, connection) {
console.log('connect', err);
if(!err) {
var request = new Request('select 42', function(err, rowCount) {
assert.strictEqual(rowCount, 1);

                // Release the connection back to the pool.
                connection.close();
                console.log('closed');
        });

        request.on('row', function(columns) {
                console.log(columns[0].value);
                assert.strictEqual(columns[0].value, 42);
            });

        connection.on('connect', function(err) {
                connection.execSql(request);
            });
    }});

So I'm not sure why it's not working for you.


Reply to this email directly or view it on GitHubhttps://github.com//issues/3#issuecomment-10739344.

from tedious-connection-pool.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.