如何监听与数据库的连接 [英] How to listen connection to database

查看:82
本文介绍了如何监听与数据库的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I'm writing a SQL Server listen connection application;

If connection is not available (connection cable is disconnected / damaged) at any time during startup or processing, my APP will sleep until the connection is available. When the connection is restored, the app will wake up and start executing SQL commands.

Please could you advise on a method needed to listen for SQL Connections.

推荐答案

请看我对这个问题的评论:这没什么意义。

你能想到的一个遥远的可能就是使用ping:

http://en.wikipedia.org/wiki/Internet_Control_Message_Protocol [ ^ ],

http ://en.wikipedia.org/wiki/Ping_%28networking_utility%29 [ ^ ],在.NET中ping
https://msdn.microsoft.com/en-us/library/system.net.networkin formation.ping%28v = vs.110%29.aspx [ ^ ]。



无论如何,我不会这样做。在不可靠的连接上使用SQL服务器是一件奇怪的事情;不确定你的活动值得努力。我可能只是浪费流量但仍然不是很有用。



-SA
Please see my comment to the question: it makes little sense.
One remote possibility you can think of would be using ping:
http://en.wikipedia.org/wiki/Internet_Control_Message_Protocol[^],
http://en.wikipedia.org/wiki/Ping_%28networking_utility%29[^],
pinging in .NET: https://msdn.microsoft.com/en-us/library/system.net.networkinformation.ping%28v=vs.110%29.aspx[^].

Anyway, I would not do it all. Using SQL servers over unreliable connections is a weird thing; not sure your activity worth the effort. I might just waste traffic and still be not very useful.

—SA


这篇关于如何监听与数据库的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆