Pierre Gardin
Pierre Gardin

Reputation: 684

How to programmatically check oracle version

I have a small .NET 3.5 program which raises errors when trying to connect to an Oracle database, if it cannot access the Oracle client DLL oci.dll or if the oracle DLL version is too old. The message is:

System.Data.OracleClient requires Oracle client software version 8.1.7 or greater.

However, the exception causes the program to crash. So I would like to make the test when the program starts and gracefully terminate it if needed, with a message informing the user that he needs to update/install/fix the installation of Oracle Client. I've seen in the stack trace the method System.Data.OracleClient.OCI.DetermineClientVersion() but it seems not to be public. Any idea?

Upvotes: 3

Views: 1662

Answers (1)

IvoTops
IvoTops

Reputation: 3531

Unfortunately that routine is not public. You might hack your way around that. Otherwise this page contains some alternatives;

https://forums.oracle.com/forums/thread.jspa?threadID=1089440&tstart=15

I specifically like the one that reads the TNSPING.EXE binary and determines the ClientVersion from that ;-)

Upvotes: 1

Related Questions