Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# perform a TNSPing programmatically

Tags:

c#

oracle

ping

Is it possible to perform a TNSPing on an Oracle Database programmatically?

I'm aware I could probably call the TNSPing program and parse any output generated but I'm looking for a more robust method of handling the database TNS Ping.

Having seen the Ping class on MSDN, I tried to use the example code found, but I think I would need some way to resolve the TNS name into an actual IP address for this method to work. Is this possible?

like image 368
TK. Avatar asked Oct 13 '22 20:10

TK.


1 Answers

This Forum seems to suggest that attempting to use TNSPing is a waste of time and that actually attempting the connection would be of more use!

It seems that catching the exceptions that might get raised during communications with a database might be the only reliable way to test that an oracle database is still there.

like image 146
TK. Avatar answered Nov 15 '22 09:11

TK.