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
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();
host
to my DB host nameConnection {
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 }
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!
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;
}
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..
host: 'localhost\\SQLEXPRESS'
I'm using host: 'localhost'
pg
package.
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. )
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
}
};
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)
dhensby on master
Update changelog for v5 Merge pull request #796 from dh… (compare)