Closed achebrol closed 2 years ago
Test with SQL*Plus and make sure you can connect with it.
yes i can connect to oracle db server using SQL*Plus
I assume you tried on the same machine as Node.js.
Somehow you have to make Node.js use that same environment so it picks up the correct libraries.
yes i have copied the oracle client libraries to build/Release
folder inside node_modules/oracledb
and i can see that node is able to load the required libraries but it just fails when i try to open a connection.i have set DPI_DEBUG_LEVEL=64
to see the extended log messages and this is what i see
C:\home\site\wwwroot>node connect.js
ODPI [09000] 2021-10-05 04:55:05.597: ODPI-C 4.2.1
ODPI [09000] 2021-10-05 04:55:05.597: debugging messages initialized at level 64
ODPI [09000] 2021-10-05 04:55:05.612: Context Parameters:
ODPI [09000] 2021-10-05 04:55:05.612: Environment Variables:
ODPI [09000] 2021-10-05 04:55:05.612: PATH => "C:\home\site\deployments\tools;C:\Program Files (x86)\SiteExtensions\Kudu\94.30524.5227\bin\Scripts;C:\Program Files (x86)\MSBuild\14.0\Bin;C:\Program Files\Git\cmd;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn;C:\Program Files (x86)\Microsoft SDKs\F#\3.1\Framework\v4.0;C:\Program Files\Git\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files (x86)\npm\6.14.11;C:\Program Files (x86)\bower\1.7.9;C:\Program Files (x86)\grunt\0.1.13;C:\Program Files (x86)\gulp\3.9.0.1;C:\Program Files (x86)\funcpack\1.0.0;C:\Python27;C:\Program Files (x86)\PHP\v5.6;C:\Program Files\nodejs\14.16.0;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft Network Monitor 3\;C:\Program Files\Git\cmd;C:\Users\imgadmin\AppData\Roaming\npm;C:\Program Files (x86)\nodejs\;C:\Program Files (x86)\Mercurial\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\dotnet;C:\Program Files\dotnet;C:\Program Files\Java\zulu8.52.0.23-jre8.0.282-win_x64\bin;"
ODPI [09000] 2021-10-05 04:55:05.612: check module directory
ODPI [09000] 2021-10-05 04:55:05.612: module name is \\?\C:\home\site\wwwroot\node_modules\oracledb\build\Release\oracledb-5.2.0-win32-x64.node
ODPI [09000] 2021-10-05 04:55:05.612: load in dir \\?\C:\home\site\wwwroot\node_modules\oracledb\build\Release
ODPI [09000] 2021-10-05 04:55:05.612: load with name \\?\C:\home\site\wwwroot\node_modules\oracledb\build\Release/oci.dll
Error: DPI-1072: the Oracle Client library version is unsupported
at OracleDb.getConnection (C:\home\site\wwwroot\node_modules\oracledb\lib\oracledb.js:273:25)
at OracleDb.getConnection (C:\home\site\wwwroot\node_modules\oracledb\lib\util.js:178:19)
at run (C:\home\site\wwwroot\connect.js:6:41)
at Object.<anonymous> (C:\home\site\wwwroot\connect.js:32:5)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
errorNum: 0,
offset: 0
}
ODPI [09000] 2021-10-05 04:55:05.628: load by OS successful
ODPI [09000] 2021-10-05 04:55:05.628: validating loaded library
If SQL*Plus can connect, then so can node-oracledb. Don't copy any files anywhere - because then you aren't testing the same configuration. Check what is different in the environment.
Even though we selected 64bit on windows for our functionapp, node architecture is being returned as ia32
and thats why i am getting Oracle Client library version is unsupported
.as its a functionapp, we were not able to compile the oracledb package for that platform. so we ended up going with a inux container route and that seems to be working fine. if we had a pre compiled binaries for ia32 architecture, it would have solved the problem i guess.
If SQL*Plus can connect, then so can node-oracledb. Don't copy any files anywhere - because then you aren't testing the same configuration. Check what is different in the environment.
i have to copy the oracle native client files to build/Release
folder or i have to set the oracle client folder path to PATH
environment variable which i can not do in a functionapp.
Thanks for the update & info. A Linux container sounds best. I'm glad you have this resolved.
What versions are you using?
process.platform: win32 process.version: v14.16.0 process.arch: x64 require('oracledb').versionString : 5.2.0 require('oracledb').oracleClientVersionString : DPI-1072: the Oracle Client library version is unsupportedStack: Error: DPI-1072: the Oracle Client library version is unsupported
Describe the problem I am getting DPI-1072: the Oracle Client library version is unsupported when trying to open the connection as well as when i try to access
oracleClientVersionString
I am facing this issue when running my code in an azure functionapp only. i did change the platform to 64bit and i see the client libraries are loaded successfullyInclude a runnable Node.js script that shows the problem.