You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Everyone. This is my first post on Github, so please excuse me for any mistakes.
I'm trying to connect to my azure MS SQL database using node.js.
Since 2 days I'm fighting with a problem for which I cannot find any answers on the internet.
I'm experienced .NET/MS SQL developer, but really a newbie in Node.JS :) But I'm progressing.
My code is:
var Connection = require('tedious').Connection;
var config = {
userName: '[username]',
password: '[password]',
server: '[server].database.windows.net',
databes: '[database]'
};
config.options = {encrypt: true, database: '[database]'}
config.options.debug = {
packet: true,
data: true,
payload: true,
token: true,
log: true
}
var connection = new Connection(config);
connection.on('debug', function(text) {
console.log(text);
});
var Request = require('tedious').Request;
var TYPES = require('tedious').TYPES;
function executeStatement() {
request = new Request("SELECT * FROM table;", function(err) {
if (err) {
console.log(err);}
});
var result = "";
request.on('row', function(columns) {
columns.forEach(function(column) {
if (column.value === null) {
console.log('NULL');
} else {
result+= column.value + " ";
}
});
console.log(result);
result ="";
});
request.on('done', function(rowCount, more) {
console.log(rowCount + ' rows returned');
});
connection.execSql(request);
}
RangeError: Offset is out of bounds
at RangeError (native)
at Buffer.write (buffer.js:778:21)
at WritableTrackingBuffer.writeString (/opt/bitnami/nodejs/lib/node_modules/tedious/lib/tracking-buffer/writable-tracking-buffer.js:216:38)
at Login7Payload.addVariableDataString (/opt/bitnami/nodejs/lib/node_modules/tedious/lib/login7-payload.js:228:25)
at Login7Payload.createVariableData (/opt/bitnami/nodejs/lib/node_modules/tedious/lib/login7-payload.js:194:12)
at new Login7Payload (/opt/bitnami/nodejs/lib/node_modules/tedious/lib/login7-payload.js:111:25)
at Connection.sendLogin7Packet (/opt/bitnami/nodejs/lib/node_modules/tedious/lib/connection.js:602:21)
at Connection.message (/opt/bitnami/nodejs/lib/node_modules/tedious/lib/connection.js:1054:16)
at Connection.dispatchEvent (/opt/bitnami/nodejs/lib/node_modules/tedious/lib/connection.js:519:45)
at MessageIO. (/opt/bitnami/nodejs/lib/node_modules/tedious/lib/connection.js:439:23)
Can you please help me?
My Node version is 6.4.0 and I'm using Bitnami account.
The text was updated successfully, but these errors were encountered:
Hi Everyone. This is my first post on Github, so please excuse me for any mistakes.
I'm trying to connect to my azure MS SQL database using node.js.
Since 2 days I'm fighting with a problem for which I cannot find any answers on the internet.
I'm experienced .NET/MS SQL developer, but really a newbie in Node.JS :) But I'm progressing.
My code is:
var Connection = require('tedious').Connection;
var config = {
userName: '[username]',
password: '[password]',
server: '[server].database.windows.net',
databes: '[database]'
};
config.options = {encrypt: true, database: '[database]'}
config.options.debug = {
packet: true,
data: true,
payload: true,
token: true,
log: true
}
var connection = new Connection(config);
connection.on('debug', function(text) {
console.log(text);
});
var Request = require('tedious').Request;
var TYPES = require('tedious').TYPES;
function executeStatement() {
request = new Request("SELECT * FROM table;", function(err) {
if (err) {
console.log(err);}
});
var result = "";
request.on('row', function(columns) {
columns.forEach(function(column) {
if (column.value === null) {
console.log('NULL');
} else {
result+= column.value + " ";
}
});
console.log(result);
result ="";
});
request.on('done', function(rowCount, more) {
console.log(rowCount + ' rows returned');
});
connection.execSql(request);
}
Error I get:
buffer.js:778
return this.ucs2Write(string, offset, length);
^
RangeError: Offset is out of bounds
at RangeError (native)
at Buffer.write (buffer.js:778:21)
at WritableTrackingBuffer.writeString (/opt/bitnami/nodejs/lib/node_modules/tedious/lib/tracking-buffer/writable-tracking-buffer.js:216:38)
at Login7Payload.addVariableDataString (/opt/bitnami/nodejs/lib/node_modules/tedious/lib/login7-payload.js:228:25)
at Login7Payload.createVariableData (/opt/bitnami/nodejs/lib/node_modules/tedious/lib/login7-payload.js:194:12)
at new Login7Payload (/opt/bitnami/nodejs/lib/node_modules/tedious/lib/login7-payload.js:111:25)
at Connection.sendLogin7Packet (/opt/bitnami/nodejs/lib/node_modules/tedious/lib/connection.js:602:21)
at Connection.message (/opt/bitnami/nodejs/lib/node_modules/tedious/lib/connection.js:1054:16)
at Connection.dispatchEvent (/opt/bitnami/nodejs/lib/node_modules/tedious/lib/connection.js:519:45)
at MessageIO. (/opt/bitnami/nodejs/lib/node_modules/tedious/lib/connection.js:439:23)
Can you please help me?
My Node version is 6.4.0 and I'm using Bitnami account.
The text was updated successfully, but these errors were encountered: