Finding oracle client version

In the TOracleSession class there is a method to get a string containing the version information of the oracle server you are connected to. Is there also a way to find out which oracle client version is used to make the connection?

We want to include this information in an error diagnostics file if the application reports a problem.
 
You would have to get the version information from the OCI Library. The filename is available in the OCIDLL variable after making a connection or calling InitOCI.
 
If I check the file information for the OCI DLL's I find 0.0.0.0 for OCI.dll and 1.0.0.5 for OCIW32.dll. Neither of these has any reference to the oracie client version.

So far the only way I could find to get some idea of the client version is to check the ORACLE_HOME_NAME registry entry (under hklm://software/oracle), which will contain a name which contains part of the version number (like orahome81, orahome92, etc). This gives us at least a clue.
 
I do something like this (abstract):

OraClientFile := FindInPath('oraclient??.dll');

GetFileVersionInfo(OraClientFile);

Result is in
result.Major := HiWord(Info^.dwFileVersionMS); {extract major version}
result.Minor := LoWord(Info^.dwFileVersionMS); {extract minor version}
result.Release := HiWord(Info^.dwFileVersionLS); {extract release version}
result.Build := LoWord(Info^.dwFileVersionLS); {extract build version}

Work's fine for me, but you have to program "findinpath" or use a combination with the solution above
 
Back
Top