简体   繁体   中英

How do I get ibm_db for Node.js to work with DB2 in Mac OS X 10.10?

Currently I'm trying to use the ibm_db node.js module to connect my application with DB2 as I did it with Windows (my past workstation's OS). I followed some guides about Mac OS X and ibm_db python module just in case, but it also doesn't work. ibm_db got to install but when I make the first database interaction it throws an error :

dyld: lazy symbol binding failed: Symbol not found: _SQLAllocHandle
Referenced from: /Users/devniel/dev/Pon.de.tu.parte/node_modules/ibm_db/build/Release/odbc_bindings.node
  Expected in: dynamic lookup

dyld: Symbol not found: _SQLAllocHandle
  Referenced from: /Users/devniel/dev/Pon.de.tu.parte/node_modules/ibm_db/build/Release/odbc_bindings.node
  Expected in: dynamic lookup

I posted an issue on Github, and they explain me that the reason is the lack of a DS Driver for Mac OS X, so, Is there a way to get it works such as the python guys does ? (I will try it tomorrow).

If you have DB2 Express-C installed on your Mac (ie the server), then you already have the client libraries that you need. When you go to build ibm_db , you can point the IBM_DB_HOME environment variable to the DB2 instance owner's sqllib directory. For example:

export IBM_DB_HOME=/Users/db2inst1/sqllib

NOTE: ibm_db will build and work, although the current release has an issue with the bindings.gyp file that prevent it from building on Mac OS X (it is configured to build ONLY on Linux). You can add the following Condition to bindings.gyp to get it to build with node-gyp :

    [ 'OS == "mac" and target_arch =="x64" ', {
      'libraries' : [
        '-L$(IBM_DB_HOME)/lib -L$(IBM_DB_HOME)/lib64 ',
        '-ldb2'
      ],
      'include_dirs': [
        '$(IBM_DB_HOME)/include'
      ],
      'cflags' : [
        "-g "
      ],
    }]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM