如何使用节点JS连接到DB2 SQL数据库? [英] How to connect to DB2 SQL database with node JS?

查看:376
本文介绍了如何使用节点JS连接到DB2 SQL数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于linux,可以使用这里的API页面,并且连接是直接的。对于OS X,当尝试连接到现有的DB2数据库时,将遇到错误:

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?

推荐答案

这个问题给你答案:

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

每次进入shell时都必须执行此操作,所以您也可以将其放在.profile或.bash_profile中。

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

这篇关于如何使用节点JS连接到DB2 SQL数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆