英文:
Test if connection is up
问题
我有一个(相当大的)连接列表。该列表包含每个连接的名称、类型和连接字符串。挑战在于OLEDB连接和ODBC连接。有多种类型的OLEDB连接(Sybase
、Netezza
、Oracle
、MSSQL
和用于Microsoft目录服务的Net-Provider for Oledb
)。
我想要检查这些连接是否正常,如果有一个连接不正常,就发送电子邮件。就是这样。
我找到了这个代码,可以帮助我检查连接。但是,它使用了select * from emp
来触发被测试的OLEDB服务器的响应。是否有其他适用于所有OLEDB连接的命令可以使用?例如,我考虑使用select getdate()
,但这对于Oracle和MDS不起作用。因此,我正在寻找任何OLEDB都可以接受的命令。
还有,如何检查ODBC连接是否正常?
英文:
I have a (rather large) list of connections. The list contains the name, type and connectionstring of each connection. The challenge is in the OLEDB connections and the ODBC connections. There are multiple kinds of OLEDB connections. (Sybase
, Netezza
, Oracle
, MSSQL
and a Net-Provider for Oledb for Microsoft Directory Services
).
I want to check if these connections are up and send an email if one is not. Thats all.
I found this code that helps me to check a connection. However, this uses a select * from emp
to evoke a reaction of the tested OLEDEB server. Is there another command that is valid for every OLEDB that I can use? I was f.e. thinking of a select getdate()
but that won't work for the Oracle and MDS. SO I am looking for a command that any OLEB will accept.
And how to check if a ODBC connection is up?
答案1
得分: 0
遍历连接列表,通过编写代码或创建一个循环来遍历列表中的每个连接(使用一个容器,例如)。
SELECT 1
此查询不依赖于任何特定的表,应该适用于大多数OLEDB/ODBC提供程序。
如果连接不起作用,您可以在SSIS中使用“发送邮件任务”来发送一封电子邮件,其中包含有关连接失败的必要详细信息。
英文:
Iterate through the list of connections by writing code or create a loop to iterate through each connection in your list. (use a container for example)
SELECT 1
This query doesn't depend on any specific table and should work with most OLEDB/ODBC providers.
If a connection is not working, you can use the Send Mail Task in SSIS to send an email with the necessary details about the failed connection.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论