wankdanker / node-odbc

ODBC bindings for node
MIT License
174 stars 79 forks source link

Connecting to netezza throws error but able to connect using isql #51

Open jayMcoder opened 5 years ago

jayMcoder commented 5 years ago

{ [Error: [unixODBC]敓癲牥愠摮漯⁲潰瑲愠瑴楲畢整⁳牡⁥浥瑰y] errors: [ { message: '[unixODBC]敓癲牥愠摮漯⁲潰瑲愠瑴楲畢整⁳牡⁥浥瑰y', state: '奈〰0' } ], error: '[node-odbc] SQL_ERROR', message: '[unixODBC]敓癲牥愠摮漯⁲潰瑲愠瑴楲畢整⁳牡⁥浥瑰y', state: '奈〰0' }

One of the stack overflow answer You have two issues. Firstly, you have an encoding mismatch between the connection and your program. The string "敓癲牥愠摮漯⁲潰瑲愠瑴楲畢整⁳牡⁥浥瑰y" decoded from UTF-16 to UTF-8 is "Server and/or port attributes are empty" -- which leads us nicely into your second issue.

I am unable to figure what could be the issue here. I followed suggestions on different forums regarding ODBC Netezza SQL driver options. Setting UnicodeTranslationOption = utf16 and DriverManagerEncoding = UTF16, but did not help. Netezza connection string used driver=NetezzaSQL;servername=netezza;port=5480;database=DEV;username=uname;password=pass

jayMcoder commented 5 years ago

Note: I am able to connect to netezza using isql and nzodbcsql with the driver config

[NetezzaSQL]
Description     = ODBC for Netezza
Driver          = /usr/local/nz/lib64/libnzodbc.so
Setup           = /usr/local/nz/lib64/libnzodbc.so
APILevel        = 1
DriverManagerEncoding = UTF-16
UnicodeTranslationOption = utf16
CharacterTranslationOption = all
DebugLogging    = true
LogPath         = /tmp
PreFetch        = 256
Socket          = 16384
v4x8182 commented 5 years ago

I too am seeing these encoding / connection issues with the 64 bit Netezza Driver v7.2.1.3 (libnzodbc.so) on RHEL 7. I have tried several encoding options and IANAAppCodePage settings of 4 and 106.

I do get an expected error response that does not have any encoding issue when pointing to the 32 bit ODBC driver.

jayMcoder commented 5 years ago

@v4x8182 I removed unixODBC 64bit driver and installed 32 bit driver. But having the same encoding issue with node-odbc in nodejs application. If you could send the details what packages you modified to install 32 bit unixODBC driver. What I understood from the last line is you are still getting error message but its in English when using 32 bit unixODBC driver, am I right?

v4x8182 commented 5 years ago

@jayMcoder you are correct. Both 32 and 64 bit versions of the Netezza driver were in the package I received. 32 bit version is in the bin and lib directories and 64 bit in the bin64 and lib64 directories. Since node is 64 bit it should point to the 64 bit libraries; however when I set "driver", in the ini file, to the 32 bit file it returns a readable (properly encoded) error of File not found. I am experiencing the exact same issue as you for 64 bit.

jayMcoder commented 5 years ago

@v4x8182 Are you trying to use /lib/libnzodbc.so file for the 32 bit version. If so ldd will show if this file has all the dependency met. Usually "File not found" error can mislead what the actual error was, I found this out when I was investigating the netezza connection issue. "ldd libnzodbc.so" shows this is not an executable file "ldd libnzsqlodbc3.so" shows there are missing dependency. Only way to resolve dependency for 32 bit version is set LD_LIBRARY_PATH to lib64 (I know which is not the right way, but I am unable to find missing dependency for 32 bit version in lib folder)

ghost commented 4 years ago

@jayMcoder I know this is an old thread; but I've found myself with the same exact problem as you. Did you ever find a solution to the encoding issue? Strange UTF-16 character error message trying to connect from .net Core 3.1 System.Data.Odbc within an ubuntu linux container.