Home >Database >Mysql Tutorial >SQL 超时解决方案 有时并不是设置问题

SQL 超时解决方案 有时并不是设置问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 18:00:341052browse

SQL 超时解决方案 有时并不是设置问题,大家可以参考下。

Server.scrīptTimeout,默认值是90秒.
要增大它,在你的asp文件中加一句,如下:
Server.scrīptTimeout=999,
将页面超时设为999秒.

最初我只设置Server.scrīptTimeout,
但仍会出现timeout错误,无论它的值设成都多大.
后在社区里看到一帖子,提到commandTimeout属性,
于是查看Option Pack文档,果然还有timeout.

Connection对象和Command对象都有个CommandTimeOut属性,
默认是30秒,如果你有一个耗时的查询或数据处理,
很容易就超时了.要增大它,也很容易,创建对象后,
设置它的属性,如下:
con.CommandTimeOut = 999,
设为999秒,其中con是一Connection对象.
如设为零,将无限等待,没有这一timeout限制.

Command对象不会继承Connection的这一属性,
所以对可能超时的Command也要单独设置CommandTimeout属性.

最后IE也有个超时设置,5分钟从服务器得不到数据,也超时.
这种情况可能很少碰到,
但当我把一10多万查询的结果保存为mdb文件时,
就遇到了.(至于保存的方法,请参看精华区中的一篇帖子.)
解决方法:(原文请参照微软KB中的Q181050)

之前在做IC交易网的时候因数据太大了,超1000万,加了内存解决
1. IE要4.01 sp1以上版本.
2. 在中HKEY_CURRENT_USERSoftwareMicrosoft
WindowsCurrentVersionInternet Settings中
加一DWORD类型ReceiveTimeout,值设为比如8个9.
3. restart computer.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn