ConnectionTimeout不工作 [英] ConnectionTimeout not working

查看:356
本文介绍了ConnectionTimeout不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试建立一个数据库故障转移(ASP经典),但我有问题的设置:ConnectionTimeout。
我将它设置为1秒,但仍然在服务器尝试连接到更多再用20秒第一个连接。
我喜欢的连接将丢失1秒后,所以我可以将用户转移到第二个连接正确的方式。

谢谢,

 <%
DSN =供应商= SQLOLEDB;数据源= 62.62.62.62;初始目录= 150109;用户ID = NOA;密码= tfdh545h54h;
DSN1 =供应商= SQLOLEDB;数据源= 127.0.0.1;初始目录= 150109;用户ID = NOA;密码= tfdh545h54h;康涅狄格州设置=的Server.CreateObject(ADODB.Connection)
conn.ConnectionTimeout = 1
conn.CommandTimeout = 1
集RS =的Server.CreateObject(ADODB.RecordSet)
在错误恢复下一页
    conn.Open DSN
    如果Err.Number的<> 0,则
        conn.Open DSN1
    万一
对错误转到0
- SQL =SELECT TOP 10 *
SQL = SQL&安培; FROM allDB
rs.Open SQL,康涅狄格州
如果(未RS.EOF)和(非rs.bof)然后
    groupARRAY = rs.GetRows
万一
rs.Close -
conn.Close
集RS =什么
康涅狄格州设置=无
%GT;


解决方案

我找了所有最相似的问题,作为您的这里的链接。请阅读。它的一个片段是在这里。


  13秒

最小的延迟来源于较低的TCP / IP层,它们
  重试的任何连接的至少3倍。这只能在被修改
  注册表(TCP / IP协议参数)


I try to build a database failover (ASP classic) but I have problem with the setting: ConnectionTimeout. I set it to 1 second but still the server try to connect to the first connection for more then 20 second. I like the connection will be lost after 1 second so I can transfer the user to the second connection right a way.

Thanks,

<%
DSN             = "Provider=SQLOLEDB; Data Source=62.62.62.62; Initial Catalog=150109;User Id=noa; Password=tfdh545h54h;"
DSN1                = "Provider=SQLOLEDB; Data Source=127.0.0.1; Initial Catalog=150109;User Id=noa; Password=tfdh545h54h;"

Set conn            = Server.CreateObject("ADODB.Connection")
conn.ConnectionTimeout = 1
conn.CommandTimeout = 1
Set rs              = Server.CreateObject("ADODB.RecordSet")
On Error Resume Next
    conn.Open DSN
    If Err.Number <> 0 Then
        conn.Open DSN1
    End If
On Error Goto 0
'--

sql ="SELECT TOP 10 *"
sql = sql & " FROM allDB"
rs.Open sql, conn
if (not rs.eof) and (not rs.bof) then
    groupARRAY = rs.GetRows
end if
rs.Close

'--
conn.Close
Set rs          = Nothing
Set conn        = Nothing
%>

解决方案

I find a all most similar question as your here its link. Please read it. A snippet of it is here.

'minimum' delay of 13 secs comes from the lower TCP/IP layers which retry any connection at least 3 times. This can only be modified in registry (TCP/IP protocol parameters)

这篇关于ConnectionTimeout不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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