Accessing Oracle Database in C++ with MS VS2017.

Download binaries (redistributables) and C++ SDK from Oracle website. For 64bit platform they are respectively:

Extract them, create a C++ project in VS2017 and link oraocci18.lib in Release configuration and oraocci18d.lib in Debug configuration.

If the application refuses to start with the following message:

App.exe - System Error
The code execution cannot proceed because MSVCR120.dll was not found. Reinstalling the program may fix this problem. 

install Visual C++ Redistributable Packages for Visual Studio 2013 that contains msvcr120.dll, msvcp120.dll, etc… or alternatively copy the newer Oracle DLLs from instantclient_18_5\vc14 directory,
they depends on msvcr120.dll , vcruntime140[d].dll and msvcp140[d].dll, see the sceenshot below:

As another alternative ODAC 18.03 can be installed. Its Setup.exe depends on Visual C++ Redistributable Packages for Visual Studio 2013 32 bit but its C++ DLLs depends on Visual C++ Redistributable Packages for Visual Studio 2013 64 bit, so its probably easier to install DLLs from ODAC 18.3 Xcopy x64 package with the following command:

install.bat basic c:\oracle\basic myhome true

or install C++ DLLs along with .NET driver with the following command:

install.bat odp.net4 c:\oracle\home myhome2 true

The installation BAT file adds a registry key that can be found as follows:

Get-ItemProperty -Path HKLM:\SOFTWARE\Oracle\* | select pschildname

or with registry editor:

ODAC Setup.exe installs the similar keys:

The DLLs have version numbers:

but as seen from above the different DLLs can have the same version number.

By the way there is a “Dependency Walker” alternative DUMPBIN that can be used in this way:

dumpbin /dependents oraocci12.dll
Dump of file oraocci12.dll

File Type: DLL

  Image has the following dependencies:


Leave a Reply

Your email address will not be published. Required fields are marked *