Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 14:34
    willmorgan commented on 889cbf1
  • Jan 31 13:15
    gsamal commented on 889cbf1
  • Jan 31 13:10
    dhensby closed #797
  • Jan 31 13:10
    dhensby commented #797
  • Jan 31 13:07
    dhensby closed #795
  • Jan 31 13:07
    dhensby commented #795
  • Jan 31 12:58
    gsamal commented #789
  • Jan 31 11:50
    cesco69 opened #797
  • Jan 31 10:22

    dhensby on master

    Update changelog for v5 Merge pull request #796 from dh… (compare)

  • Jan 31 10:22
    dhensby closed #796
  • Jan 31 09:53
    dhensby commented #789
  • Jan 31 09:52
    dhensby commented #778
  • Jan 31 09:51
    dhensby review_requested #796
  • Jan 31 09:51
    dhensby opened #796
  • Jan 31 06:45
    suckerp commented #795
  • Jan 31 02:58
    liumorgan starred tediousjs/node-mssql
  • Jan 31 02:15
    zhoukk starred tediousjs/node-mssql
  • Jan 30 22:22
    vjpr edited #795
  • Jan 30 22:22
    vjpr edited #795
  • Jan 30 22:22
    vjpr opened #795
trivedimehulk
@trivedimehulk
David this is my poc code. I’ll take care of it.
David Gasperoni
@mcdado
Alright, I was just wondering. Because that definitely adds some delay. I’m not sure about blocking though, as you seem to always do the right thing and return promises/callbacks
Zheyi Zhu
@Voxis

hi im trying to dynamically add tvp data into tvp table. I need some help here…
I have already new the table and added the columns no problem there

let columns = _.map(tvpData.columns, 'name');
tvpData.data.forEach((item) => {
        tvp.rows.add.apply(null, columns.map((c) => item[c]));
});

but it seems stuck in this foreach. any help would be appreciated

Tim Oien
@toien44
Looking into tools to test against a DB and someone pointed me here. I need to test against SQL Management studio client I guess it's a GUI interface but should still be able to throw commands at it. Would this library work to verify that a job is set correctly and ran?
Tim Oien
@toien44
What tools do people use for using this on a mac? I need a GUI interface too to verify my tests/ steps.
Sean Kelly
@seank-com
I used to use MySQL Workbench. Don't know if it is compatible with MSSQL. Failing that you can always install Windows on a VirtualBox VM
Wellington Rodriguez
@wrod7
@toien44 SQL Operations Studio
dmanhaus
@dmanhaus
If you’re looking to issue SQL commands against a SQL DB on a Mac, I recommend using VS Code. It works well, includes intellisense and source control. Plus it’s good for just about any other language you need to develop in.
Tim Oien
@toien44
ok thanks all
dmanhaus
@dmanhaus
...just be sure to add the MSSQL extension after you install it.
Tim Oien
@toien44
I'm not looking for an editor as I have one I need a way to view the tables on a mac. I'd prefer to not use a VM
Sean Kelly
@seank-com
VSCode will display a table as a result of your SQL query. It's really pretty slick.
Tim Oien
@toien44
oh nice thanks
David Gasperoni
@mcdado
Sql operations Studio by Microsoft
It’s in alpha I think
It’s an electron-based app that’s multi-platform
Tim Oien
@toien44
I'm trying to set up a DB connection would host be the name of the database or a URL?
var mysql      = require('mysql');
var connection = mysql.createConnection({
  host     : 'localhost',
  user     : 'me',
  password : 'secret',
  database : 'my_db'
});

connection.connect((err) => {
    if (err) {
        console.error(`error connecting: ${err.stack}`);

        return;
    }

    console.log(`connected as id ${connection.threadId}`);
});

connection.end();
Tim Oien
@toien44
I got the HOST figured out however, I can't get the console log to print out
Tim Oien
@toien44
This is what I'm getting when I print out connection. I've changed host to my DB host name
Connection {
  domain: null,
  _events: {},
  _eventsCount: 0,
  _maxListeners: undefined,
  config:
   ConnectionConfig {
     host: '...',
     port: 3306,
     localAddress: undefined,
     socketPath: undefined,
     user: '...',
     password: '...',
     database: '...',
     connectTimeout: 10000,
     insecureAuth: false,
     supportBigNumbers: false,
     bigNumberStrings: false,
     dateStrings: false,
     debug: undefined,
     trace: true,
     stringifyObjects: false,
     timezone: 'local',
     flags: '',
     queryFormat: undefined,
     pool: undefined,
     ssl: false,
     multipleStatements: false,
     typeCast: true,
     maxPacketSize: 0,
     charsetNumber: 33,
     clientFlags: 455631 },
  _socket: undefined,
  _protocol:
   Protocol {
     domain: null,
     _events: {},
     _eventsCount: 0,
     _maxListeners: undefined,
     readable: true,
     writable: true,
     _config:
      ConnectionConfig {
        host: '...',
        port: 3306,
        localAddress: undefined,
        socketPath: undefined,
        user: '...',
        password: '...',
        database: '...',
        connectTimeout: 10000,
        insecureAuth: false,
        supportBigNumbers: false,
        bigNumberStrings: false,
        dateStrings: false,
        debug: undefined,
        trace: true,
        stringifyObjects: false,
        timezone: 'local',
        flags: '',
        queryFormat: undefined,
        pool: undefined,
        ssl: false,
        multipleStatements: false,
        typeCast: true,
        maxPacketSize: 0,
        charsetNumber: 33,
        clientFlags: 455631 },
     _connection: [Circular],
     _callback: null,
     _fatalError: null,
     _quitSequence: null,
     _handshake: false,
     _handshaked: false,
     _ended: false,
     _destroyed: false,
     _queue: [],
     _handshakeInitializationPacket: null,
     _parser:
      Parser {
        _supportBigNumbers: false,
        _buffer: <Buffer >,
        _nextBuffers: [Object],
        _longPacketBuffers: [Object],
        _offset: 0,
        _packetEnd: null,
        _packetHeader: null,
        _packetOffset: null,
        _onError: [Function: bound handleParserError],
        _onPacket: [Function: bound ],
        _nextPacketNumber: 0,
        _encoding: 'utf-8',
        _paused: false } },
  _connectCalled: false,
  state: 'disconnected',
  threadId: null }
Oliver Jourmel
@ojourmel

Hi folks,

Does anyone have any experience with using SESSION_CONTEXT on SqlServer 2016/2017?

I'm running into some issues, and I'm hoping someone can help me confirm it's not just me!

// Assuming some connection pool: cp
const sql = require('mssq');
const request = new sql.Request(cp).query("SELECT SESSION_CONTEXT(N'user_var') AS [sc]");
request
    .then(r => console.log(r))
    .catch(e => console.log(e));

I'm running into an internal error, with an unknown sqlstate. I'm hoping I'm missing something here. Any ideas?

Cheers!

Oliver Jourmel
@ojourmel

Turns out this error is caused by invalid types... SESSION_CONTEXT returns sql_variant which is not supported by node-mssql.

Casting / converting the result to nvarchar seems to fix the error:

SELECT CONVERT(NVARCHAR(max), SESSION_CONTEXT(N'key')) AS [sc]

Cheers!

alexlpze
@alexlpze_twitter
Hi, I'm new using mssql module and I'm trying to implement a repository where each method open a execute some queries and then close the pool but when I stress the method I'm receiving an error about global connection that already exists. does anyone have a connection pool using example?
alexlpze
@alexlpze_twitter
here is a simple example (I avoid try catch and another code to short the example)
const sql = require('mssql');

async  getCatalogbyId({dbconfig, catId}){
   let pool = await sql.connect(dbconfig);
   let catalog = await pool.request().query(`SELECT * FROM oper.CATALOG WHERE  CATID = ${catId}`);
   return catalog.recordset;
}
Wellington Rodriguez
@wrod7
has anyone ever ran into TimeoutError: ResourceRequest timed out? how can i fix this without having to restart the node app?
camarrone
@camarrone
hello everyone
Labs
@labs20
Hi. I'm running into ResourceRequest time out too without any plausible clue. Its random, the server is not overloaded (its a test environment). Any ideas or directions anyone? Thanks!
Wellington Rodriguez
@wrod7
i switched all my methods to prepared statements and i don’t get the error anymore. but still would like to have it reconnect when the error is thrown
Labs
@labs20
mmm... thanks for the info. I'll check on that.
But it still sounds a little off, doesn't it?
Jason Luboff
@JLuboff
I am using SQL Express for dev, and was experiencing timeouts (no real rhyme or reason). I was using a named instance. I found that if I went into SQL Server Configuration tool, Protocols section and then in the TCP/IP settings under IP Addresses changed TCP Dynamic Ports to blank and TCP Port to 1433, after restarting the service, no longer have time outs. Don't recall if this is the same type of timeouts you both are refering to...but worth looking into..
So now in my config instead of using host: 'localhost\\SQLEXPRESS' I'm using host: 'localhost'
Labs
@labs20
Thanks. Will check on that too. Right now I've upped my pool.max to 10000 and running some tests.
Labs
@labs20
having a hard time with this one.
If someone could help, apreciate. => tediousjs/node-mssql#615
sarath125
@sarath125
Hi guys I am Trying to connect sql server through window authentication for that i installed msnodesqlv8 i changed connection string according to that but i am geeting error like binaries loaded successfully. Is your node version either latest 4, 5, 6, 7, 8 or 9 ? i Tried with node version 9.5 in electron atom
John Woodruff
@johnbwoodruff
question, by default querying date columns inflates them to JavaScript Date objects. I can’t figure out, without doing a post-query map, how to get those as strings. Is there a way to specify that I want certain column types always back as a string?
Jason Luboff
@JLuboff
@jbw91 In your select statement use a Cast or Convert
John Woodruff
@johnbwoodruff
in my situation that’s not ideal, as it’s generated queries based on various criteria, and I won’t know when it’s a date column vs not to be able to cast it.
I was hoping there’d be some built in option, like is found in the pg package.
it essentially allows me to provide a parseFn for specified data types
Jason Luboff
@JLuboff
Gotcha. I've never dealt with generated queries, so can't be of much help unfortunately.
John Woodruff
@johnbwoodruff
thanks for trying! :)
Jason Luboff
@JLuboff
:+1:
iRazerXY
@iRazerXY
Hi, im having an issue:
Im trying to install and try some code with mssql, but whenever I try to run the code it gives me: "Unknown plugin "transform-runtime""
Any suggestions?
Wellington Rodriguez
@wrod7
anyone running graphql with mssql?
Sriramajeyam
@yesoreyeram

Hi all, My query looks like

select 1,2,3,4;

in results.recordset, what i was exptecting is for the object result.recordset.toTable()

{
    "columns":[
        {"name":"","nullable":false},
        {"name":"","nullable":false},
        {"name":"","nullable":false},
        {"name":"","nullable":false}
    ],"
    rows":[
        [1,2,3,4]
    ]
}

instead I am getting

{"columns":[{"name":"","nullable":false}],"rows":[[[1,2,3,4]]]}

How to overcome this? (Results are automatically grouped in to object based on column headers. in my case no column names are preset. )

sarath125
@sarath125

Hi i am using mssql nodejs package, encrypted data and NTLM login is throwing issue
(node:9988) [DEP0064] DeprecationWarning: tls.createSecurePair() is deprecated. Please use tls.Socket instead.

my Config File look like this
var config = {
"userName": "user.name",
"password": "password",
"server": "servername",
"domain": "DOMAIN_NAME_CAPITALIZED_AND_NOT_FQDM",
"options": {
"encrypt": false
}
};

Nelson Wells
@nelsonwellswku
does anyone have any experience using transactions with promises or async await? i'm calling trans.rollback() but it doesn't seem to actually perform the rollback and I'm at a loss why
Nelson Wells
@nelsonwellswku
I figured it out. You can't use connection.request(transaction) if your transaction was made with a different connection. derp.
Dai Nguyendo
@dainguyendo
Greetings, wondering if anyone has had experiences with using bulk requests and inserting geometry type data? I have a pretty simple scenario but specifically introduction a geometry column results in this error TypeError: "value" argument is out of bounds at checkInt (buffer.js:1041:11) at Buffer.writeUInt16LE (buffer.js:1099:5) at WritableTrackingBuffer.writeUInt16LE (/var/task/node_modules/tedious/lib/tracking-buffer/writable-tracking-buffer.js:87:19) at WritableTrackingBuffer.writeUsVarbyte (/var/task/node_modules/tedious/lib/tracking-buffer/writable-tracking-buffer.js:243:12) at Object.writeParameterData (/var/task/node_modules/tedious/lib/data-type.js:864:25) at BulkLoad.addRow (/var/task/node_modules/tedious/lib/bulk-load.js:141:17) at parent.acquire (/var/task/node_modules/mssql/lib/tedious.js:473:16) at _acquire.then.connection (/var/task/node_modules/mssql/lib/base.js:172:42) at process._tickDomainCallback (internal/process/next_tick.js:135:7)