node.jsamazon-web-servicesnode-oracledb

Error: DPI-1047 Oracle Database Connection Error


I'm trying to connect oracle database with node-oracledb but i have this error.

Error: DPI-1047: Cannot locate a 64-bit Oracle Client library: "dlopen(libclntsh.dylib, 0x0001): tried: 'libclntsh.dylib' (no such file), '/usr/local/lib/libclntsh.dylib' (not a mach-o file), '/usr/lib/libclntsh.dylib' (no such file), '/Users/onuryuksekkaya/Documents/done/getwebee-pms/.webpack/service/libclntsh.dylib' (no such file), '/usr/local/lib/libclntsh.dylib' (not a mach-o file), '/usr/lib/libclntsh.dylib' (no such file)". See https://oracle.github.io/odpi/doc/installation.html#macos for help
Node-oracledb installation instructions: https://oracle.github.io/node-oracledb/INSTALL.html
You must have the arm64 Oracle Instant Client Basic or Basic Light package in ~/lib or /usr/local/lib
They can be downloaded from http://www.oracle.com/technetwork/database/database-technologies/instant-client/overview/index.html

Is there a quick solutions for this ?

I'm using node 14.18.1 and oracle 4.2.0 and m1 macbook pro


Solution

  • I fixed this problem like this:

    first of all , you have to install node-oracledb from source code. it has to be like this(it depends on your oracledb version)

    "oracledb": "https://github.com/oracle/node-oracledb/releases/download/v5.3.0/oracledb-src-5.3.0.tgz",
    

    then you have to download x86 oracle instantclient Basic Package (ZIP) from here : https://www.oracle.com/database/technologies/instant-client/macos-intel-x86-downloads.html

    then you have to change your node version from arm to x86. you can change it in your zsh terminal with this command

    arch -x86_64 zsh    
    

    (you have to install node modules with node x64 version)

    if you want to make sure to your node version is x64 you can follow these steps on terminal

    node console.log(process.arch)

    output will be your arch. it has to be x64

    when you use these command you will install oracle instant client rm /usr/local/lib/libclntsh.dylib ln -s ~/Downloads/instantclient_19_8/libclntsh.dylib /usr/local/lib

    when you try to run your project, output will be permisson error with a document name. You have to open these documents with a text editor, one by one. When you open all these documents, you can run your project freely.