Code Monkey home page Code Monkey logo

node-mssql-connector's Introduction

Hi there, I am Christopher ๐Ÿ‘‹๐Ÿฝ

I am a Software Engineer from a small city near Munich and are currently working for Sky Germany as a Senior Software Manager and beside this I am owning my own business webCIT.

Feel free to reach out!

node-mssql-connector's People

Contributors

mkaloer avatar nachbarshund avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

node-mssql-connector's Issues

Params error

I get this error ๐Ÿ‘

q1.execute {"name":"param-not-found","message":"Param 'username' was not found in query or is tried to set twice"}

with this code

    var conn = require('node-mssql-connector');
    var TYPES = require('tedious').TYPES
    sql = new conn( {...});
...
    var query = sql.query(
        "SELECT  staffID, commonName, firstName, surname, email " +
        "FROM staff_member " +
        "where  Username = @username ");
    query.param( "username", TYPES.NVarChar,  process.env.USERNAME );
    query.exec( function( err, rs ){
        if (err) return console.log("query.execute "+JSON.stringify(err));
        var staffID = rs.result[0].staffid; // why is camelCase flattened? e.g. staffID -> staffid
...

if I comment out the param line I get

q1.execute {"name":"request-error","message":{"name":"RequestError","message":"Must declare the scalar variable \"@username\".","code":"EREQUEST","number":137,"state":2,"class":15,"serverName":"HRSHSQ
L01","procName":"","lineNumber":1}}

Looks like a bug/design error to me

I had to use the string "NVarChar" to make it work
Noel

Error Handling

The current error message is good, but I am missing some usefull information about the query that caused the error.

Current error message:
{ name: 'request--params-errors', message: [TypeError: value is out of bounds] }

The error should contain some kind of a stracktrace.

Error on timeout

if the connection cannot be established and the driver responds with a "timeout" an error is thrown.

TypeError: Cannot read property 'release' of undefined
    at Object.callback (/usr/src/node_modules/node-mssql-connector/lib/mssqlconnector.js:566:21)
    at null._onTimeout (/usr/src/node_modules/node-mssql-connector/node_modules/tedious-connection-pool/lib/connection-pool.js:190:32)
    at Timer.listOnTimeout (timers.js:92:15)

Stored Procedures

The read me says to call a stored procedure like

storedprod.( function( err, res ){

I was not able to get that to work, had to call the stored procedure like this:

storedprod.exec( function( err, res ){

May just be a type-o in the read me.

param names with _ don't work

Example:

query = MSSQLClient.query("
   SELECT * FROM Products WHERE net_price > @net_price
")
query.param('net_price', 'Money', net_price)

Failed connection after a several hundred requests

Using a ping method to check the uptime status of the DB.

Just doing a simple SELECT every 5 minutes:

query = MSSQLClient.query("SELECT TOP 1 ID FROM someTable")
                query.exec (err, resp) ->
                        if err
                                cb(err)
                                return
                        if resp.rowcount is 1
                                cb(null, true)
                        return

After several hundred of these i get this error.

{ [connection-failed: connection to 192.168.11.101:1433 - failed Error: connect EMFILE]
  name: 'connection-failed',
  message: 'connection to 192.168.11.101:1433 - failed Error: connect EMFILE',
  customError: true }

After this no other network connections (e.g. http requests via request) can be made as it seems the node process is out of sockets or something.

node 4.2.3

are there known issues with node version 4.2.3 (LTS)?

i get errors when using node 4.2.3, i tried these versions:

/usr/build/node_modules/node-mssql-connector/lib/mssqlconnector.js:116
          connection.release();
                    ^

TypeError: Cannot read property 'release' of undefined
    at Object.callback (/usr/build/node_modules/node-mssql-connector/lib/mssqlconnector.js:116:21)
    at null._onTimeout (/usr/build/node_modules/node-mssql-connector/node_modules/tedious-connection-pool/lib/connection-pool.js:193:32)
    at Timer.listOnTimeout (timers.js:92:15)
(node) warning: possible EventEmitter memory leak detected. 11 error listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at ConnectionPool.addListener (events.js:239:17)
    at MSSQLRequestBase.exec (/usr/build/node_modules/node-mssql-connector/lib/mssqlconnector.js:101:27)
    at MSSQLRequestBase.exec (/usr/build/node_modules/node-mssql-connector/lib/mssqlconnector.js:3:61)
    at Schema.Entity._query (/usr/build/dynasiteNG/server/js/lib/entity.js:72:13)
    at Schema._query (/usr/build/dynasiteNG/server/js/lib/entity.js:3:59)
    at Schema.Entity._queryGet (/usr/build/dynasiteNG/server/js/lib/entity.js:374:12)
    at Schema._queryGet (/usr/build/dynasiteNG/server/js/lib/entity.js:3:59)
    at Schema.Materials.get (/usr/build/stylebase/server/js/modules/styles/materials/model.js:514:12)
    at Schema.get (/usr/build/stylebase/server/js/modules/styles/materials/model.js:3:59)
    at Array.async.auto._accessories (/usr/build/stylebase/server/js/modules/styles/model.js:1087:34)
    at listener (/usr/build/node_modules/async/lib/async.js:600:42)
    at /usr/build/node_modules/async/lib/async.js:542:17
    at _arrayEach (/usr/build/node_modules/async/lib/async.js:85:13)
    at Immediate.taskComplete (/usr/build/node_modules/async/lib/async.js:541:13)
    at processImmediate [as _immediateCallback] (timers.js:383:17)

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.