How to connect to DB2 SQL database with node JS?

眉间皱痕 提交于 2019-12-13 06:35:19

问题


For linux, one can use the API page found here, and connecting is straight forward. For OS X, one will run into the error when trying to connect to an existing DB2 database:

{ [Error: [IBM][CLI Driver] SQL1042C  An unexpected system error occurred.  SQLSTATE=58004 ] error: '[node-odbc] SQL_ERROR', message: '[IBM][CLI Driver] SQL1042C  An unexpected system error occurred.  SQLSTATE=58004\n', state: 'HY000' }

Does anyone know how to fix this problem?


回答1:


The latest answer on this issue gives you the answer:

export DYLD_LIBRARY_PATH=/Users/.../<project_folder>/node_modules/ibm_db/installer/clidriver/lib/icc
node app.js

You have to do this every time you enter the shell, so you may as well put this in your .profile or .bash_profile.



来源:https://stackoverflow.com/questions/30732024/how-to-connect-to-db2-sql-database-with-node-js

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!