Thursday, April 9, 2009

Get Oracle Client Version

I've seen this all over the web using tnsping.exe or sqlplus..both of which are not guaranteed to be on the clients machine.. Some still would try calling a function of oci.dll that gives you the client version..but that function is not supported below i believe version 9 (dont quote me on that..i know its in 10, and i know its not in 8)

So this my contribution, and what i think to be the best way to get the oracle client version programaticalyaly..

Note: No error checking done here..

c#:

//Load oracle
lp_oci_dll = LoadLibraryExA("oci.dll", IntPtr.Zero, 8);

//Gets the path of oci.dll
System.Text.StringBuilder ls_buffer = new System.Text.StringBuilder(1024);
GetModuleFileNameA(lp_oci_dll, ls_buffer, 1024);

//Get oracle version
FileVersionInfo l_file_info = FileVersionInfo.GetVersionInfo(ls_buffer.ToString());
ls_ret = l_file_info.FileVersion;

4 comments:

Anonymous said...

Wonderful post! We are linking to this great content on our website.

Keep up the great writing.

Have a look at my weblog :: rtg casinos for usa players

Anonymous said...

I all the time used to study paragraph in news papers but now
as I am a user of net thus from now I am using net
for content, thanks to web.

my website - rtg casino

Anonymous said...

I am really enjoying the theme/design of your site.
Do you ever run into any web browser compatibility issues?
A small number of my blog readers have complained about my website not operating correctly in
Explorer but looks great in Safari. Do you have any ideas to
help fix this problem?

my web site usa casino bonus

Anonymous said...

whoah this blog is magnificent i really like reading your
articles. Keep up the good work! You understand, a lot of persons are hunting around for this
info, you could help them greatly.

my site: golden casino online