-
Notifications
You must be signed in to change notification settings - Fork 469
Debugging TDS
Patrik Simek edited this page Apr 25, 2017
·
3 revisions
Enable debugging in your config.
var config = {
user: '...',
password: '...',
server: 'localhost',
database: '...',
debug: true // <--- here
}
Attach debug
event handler to connection pool.
const pool = new sql.ConnectionPool(config)
pool.on('debug', (connection, message) => {
console.log(message)
})
pool.connect()
It logs all TDS traffic between your app and SQL Server. Logs should look like this:
connected to 192.168.5.130:1433
Sent
type:0x12(PRELOGIN), status:0x01(EOM), length:0x002F, spid:0x0000, packetId:0x01, window:0x00
0000 00001A00 06010020 00010200 21000103 00220004 04002600 01FF0000 00010001 ....... ....!... ."....&. ........
0020 02000000 000000 .......
PreLogin - version:0.0.0.1 1, encryption:0x02(NOT_SUP), instopt:0x00, threadId:0x00000000, mars:0x00(OFF)
State change: Connecting -> SentPrelogin
Received
type:0x04(TABULAR_RESULT), status:0x01(EOM), length:0x002B, spid:0x0000, packetId:0x01, window:0x00
0000 00001A00 06010020 00010200 21000103 00220000 04002200 01FF0B00 08340000 ....... ....!... ."....". .....4..
0020 020000 ...
PreLogin - version:11.0.8.52 0, encryption:0x02(NOT_SUP), instopt:0x00, threadId:0x00000000, mars:0x00(OFF)
And many more of similar lines.
IMPORTANT: These logs contains binary serialized credentials to your SQL Server! Always change your password before you send those logs to anyone.
NOTE: Debugging only work with default Tedious driver.