I have just upgrade from version 0.2.4 to the latest on the understanding that it now supports the older SQL2000 which I don't believe was supported previously.
I can connect to 2008 no problem, but as soon as I try and connect to 2000 it crashes the engine with a 'unknown type: 0' error, this error is not caught by the error handler.
here's the connection info and the error, the engine and source are a couple of additional vars that I use and are un-related to tedious:
{ server: '192.168.42.4',
userName: 'XXX',
password: 'xxx',
engine: 'MSSQL',
source: 'sqlite',
options:
{ database: 'xxx',
textsize: '2147483647',
connectTimeout: 15000,
requestTimeout: 15000,
cancelTimeout: 5000,
packetSize: 4096,
tdsVersion: '7_4',
isolationLevel: 2,
encrypt: false,
cryptoCredentialsDetails: {},
useUTC: true,
useColumnNames: false,
connectionIsolationLevel: 2,
readOnlyIntent: false,
enableAnsiNullDefault: true,
port: 1433 }
}
Error: Unknown type: 0
at Parser.parseTokens (/usr/share/nodejs/dev/run/pure/node_modules/tedious/lib/token/stream-parser.js:94:30)
at Parser._transform (/usr/share/nodejs/dev/run/pure/node_modules/tedious/lib/token/stream-parser.js:67:14)
at Parser.Transform._read (/usr/share/nodejs/dev/run/pure/node_modules/readable-stream/lib/_stream_transform.js:172:10)
at Parser.Transform._write (/usr/share/nodejs/dev/run/pure/node_modules/readable-stream/lib/_stream_transform.js:160:12)
at doWrite (/usr/share/nodejs/dev/run/pure/node_modules/readable-stream/lib/_stream_writable.js:335:12)
at writeOrBuffer (/usr/share/nodejs/dev/run/pure/node_modules/readable-stream/lib/_stream_writable.js:321:5)
at Parser.Writable.write (/usr/share/nodejs/dev/run/pure/node_modules/readable-stream/lib/_stream_writable.js:248:11)
at Parser.addBuffer (/usr/share/nodejs/dev/run/pure/node_modules/tedious/lib/token/token-stream-parser.js:59:26)
at Connection.sendDataToTokenStreamParser (/usr/share/nodejs/dev/run/pure/node_modules/tedious/lib/connection.js:684:37)
at Connection.data (/usr/share/nodejs/dev/run/pure/node_modules/tedious/lib/connection.js:1108:21)
at Connection.dispatchEvent (/usr/share/nodejs/dev/run/pure/node_modules/tedious/lib/connection.js:559:45)
at MessageIO.<anonymous> (/usr/share/nodejs/dev/run/pure/node_modules/tedious/lib/connection.js:476:16)
at emitOne (events.js:90:13)
at MessageIO.emit (events.js:182:7)
at ReadablePacketStream.<anonymous> (/usr/share/nodejs/dev/run/pure/node_modules/tedious/lib/message-io.js:101:13)
at emitOne (events.js:90:13)
Any ideas on what the cause may be ?
OK, I have found the cause, it seems that auto negociation is not working on 2000 (it selected 7.4 instead of 7.1) and it is therefore necessary to specify the version in the connection.
Once I did this it connected no problem, I think this may be a bug ?
Yeah, this must a bug in the version negotiation / detection code. We don't run unit / integration tests against SQLServer 2000 (only 2008 and later), so I'll have to set it up on my machine somehow to test this.
Thanks @diginfo . This solved my issue two years later.
Would be great if there was a more descriptive error message to debug this.
This is a really long shot!
I am using node-red-contrib-sqldbs to talk to my DBs, and i have one which is 2000. anyone know how i can set the TDS in this sort of instance?
cheers!
var config = {
options: {
tdsVersion: '7_1'
}
}
I've updated the docs to clarify to use tdsVersion: '7_1'
for SQL Server 2000. Thanks @diginfo for the pointer!
Most helpful comment
OK, I have found the cause, it seems that auto negociation is not working on 2000 (it selected 7.4 instead of 7.1) and it is therefore necessary to specify the version in the connection.
Once I did this it connected no problem, I think this may be a bug ?