-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ibm_db 2.6.1 blob data corrupted #582
Comments
@wnwaynelee This test case is working fine for me on Windows, Linux and Macos. I am unable to reproduce it. Could you please provide little bit more detail to reproduce it like node.js version, OS name, have installed any db2 client or server in the system, your db2 server is local or remote etc. Thanks. |
@bimalkjha My node.js is v10.16.3 running on Windows 10 Enterprise 1903 build 18362.295. There is no db2 client installed on Windows. Node.js is using the prebuild binary from ibm_db. My db2 is v11.5.0.0 on Docker 19.03.2 on Ubuntu 18.04.3 LTS. Thanks. |
@bimalkjha To rule out that this is an OS or node version issue, I tried |
@wnwaynelee Thanks for sharing the info. I am able to reproduce the issue. I am curious to know why the assert at line https://github.com/ibmdb/node-ibm_db/blob/master/test/test-blob-insert.js#L87 do not fail? Because of this non working assert, test case was passing in batch run. |
@bimalkjha The tests should be done using assert.equal |
Looks the issue is due to copying of binary data in utf8string by https://github.com/ibmdb/node-ibm_db/blob/master/src/odbc.cpp#L987. Conversion of binary to utf8 causes expansion of data and getting corrupted. |
@bimalkjha Nan only has Utf8String because old versions of Node.js only support UTF-8. If you're okay with using the V8 API directly, you can use Caveat emptor: it doesn't take an |
@wnwaynelee I have delivered the fix for this issue on github. It would be part of next release. |
* doc: Docker Linux Container instructions * support for install --debug option on windows * fix: blob data corruption issue #582 * doc: update doc for executeNonQuerySync API, issue #583 * force push connection to the queue when poolSize breaches maxPool boundry (#581) * Support for node v12 on z/OS, and fix some test cases for z/OS (#586) * fix: update unzipper version, issue #588 * fix: use v8::Isolate for nodev >= 11 * fix: ignore sqlcode 100 by executeNonQuery, issue #591 * fix: add executeNonQuerySync in odbc.js issue #595
* doc: update for issue #593 (Bimal Jha) * fix: update windows binary using latest code (Bimal Jha) * fix: for memory leak issue #576 (Bimal Jha) * fix: update windows binary for vscode 1.40.x (Bimal Jha) * update windows binaries (Bimal Jha) * fix: add executeNonQuerySync in odbc.js issue #595 (Bimal Jha) * fix: ignore sqlcode 100 by executeNonQuery, issue #591 (Bimal Jha) * fix: use v8::Isolate for nodev >= 11 (Bimal Jha) * fix: update unzipper version, issue #588 (Bimal Jha) * Support for node v12 on z/OS, and fix some test cases for z/OS (#586) (alexcfyung) * force push connection to the queue when poolSize breaches maxPool boundry (#581) (ashutoshrnjn) * doc: update doc for executeNonQuerySync API, issue #583 (Bimal Jha) * fix: blob data corruption issue #582 (Bimal Jha) * support for install --debug option on windows (Priyanka Manoharan) * doc: Docker Linux Container instructions (Bimal Jha)
Steps to reproduce the problem in 2.6.1
The output is
img1.length = 685239
text.length = 841665
buffer data = 49 49 2A 00 C8 8C 00 00 73 C5 3C 13 83 39 98 35
Lengths after select = 1038449, 841665
buffer after select : 49 49 2A 00 C8 8C 00 00 73 C5 3C 13 83 39 98 35
done
Note that the img1.length is 685239 while the Lengths after select is 1038449. Setting DB2CODEPAGE=1208 according to #579 does not help.
With 2.5.3, the output is
img1.length = 685239
text.length = 841665
buffer data = 49 49 2A 00 C8 8C 00 00 73 C5 3C 13 83 39 98 35
Lengths after select = 685239, 841665
buffer after select : 49 49 2A 00 C8 8C 00 00 73 C5 3C 13 83 39 98 35
done
Note that the img1.length is identical to the Lengths after select.
The text was updated successfully, but these errors were encountered: