C# perform a TNSPing programmatically

心不动则不痛 提交于 2019-12-10 15:39:48

问题


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?


回答1:


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.




回答2:


Not sure you can directly - it's the Oracle client software that resolves the TNS name to an IP address and I don't know of any call on the Oracle.DataAccess.Client that would do that for you.



来源:https://stackoverflow.com/questions/4367240/c-sharp-perform-a-tnsping-programmatically

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!