通常您需要检查以下内容以确保设置有效(这也适用于任何使用 ODBC 包装器的数据源):
1.设置环境变量
经验法则是您希望将 Netezza odbc 驱动程序放在每个环境变量的最开头:
DJX_ODBC_LIBRARY_PATH=/opt/ibm/home/bigsql/resources/lib64/:/opt/oemclient/odbc71/64/lib/:/opt/oemclient/odbc60/64/lib
DB2LIBPATH=/opt/ibm/home/bigsql/resources/lib64/:/opt/oemclient/odbc71/64/lib/:/home/iidev20/sqllib/lib
LIBPATH=/opt/ibm/home/bigsql/resources/lib64/:/opt/oemclient/odbc71/64/lib/:/home/iidev20/sqllib/lib:/opt/oemclient/odbc60/64/lib
ODBCINI=/home/iidev20/bin/odbc.ini
DB2LIBPATH=/opt/ibm/home/bigsql/resources/lib64/:/opt/oemclient/odbc71/64/lib/:/home/iidev20/sqllib/lib:/opt/csdlclient/oracle/lib:/opt/oemclient/odbc60/64/lib:/opt/csdlclient/informix/64/lib
LD_LIBRARY_PATH=/opt/ibm/home/bigsql/resources/lib64/:/opt/oemclient/odbc71/64/lib/:/home/iidev20/sqllib/lib:/opt/oemclient/odbc60/64/lib
2.设置odbc.ini对应的DSN
[ODBC]
IANAAppCodePage=4
InstallDir=/opt/ibm/home/bigsql/resources/lib64/
TraceDll=
TraceFile=odbctrace.out
UseCursorLib=0
3.运行db2set
db2set DB2_DJ_INI=/home/iidev20/sqllib/cfg/db2dj.ini
db2set DB2LIBPATH=/opt/ibm/home/bigsql/resources/lib64/:/opt/oemclient/odbc71/64/lib/:/opt/oemclient/odbc71/64/
4.修改db2dj.ini
DJX_ODBC_LIBRARY_PATH=/opt/ibm/home/bigsql/resources/lib64/:/opt/oemclient/odbc 71/64/lib/:/opt/oemclient/odbc60/64/lib
DB2LIBPATH=/opt/ibm/home/bigsql/resources/lib64/:/opt/oemclient/odbc71/64/lib/:/home/iidev20/sqllib/lib
LIBPATH=/opt/ibm/home/bigsql/resources/lib64/:/opt/oemclient/odbc71/64/lib/:/home/iidev20/sqllib/lib:/opt/oemclient/odbc60/64/lib
ODBCINI=/home/iidev20/bin/odbc.ini
DB2LIBPATH=/opt/ibm/home/bigsql/resources/lib64/:/opt/oemclient/odbc71/64/lib/:/home/iidev20/sqllib/lib:/opt/csdlclient/oracle/lib:/opt/oemclient/odbc60/64/lib:/opt/csdlclient/informix/64/lib
LD_LIBRARY_PATH=/opt/ibm/home/bigsql/resources/lib64/:/opt/oemclient/odbc71/64/lib/:/home/iidev20/sqllib/lib:/opt/oemclient/odbc60/64/lib
5.重启使配置生效