我得到了一个用 Classic ASP 编写的 Web 应用程序,用于从 Windows 2003 Server(SQL Server 2000 和 IIS 6)移植到 Windows 2008 Server(SQL Server 2008 和 IIS 7.5)。
该站点使用一个GLOBAL.ASA
文件来定义全局变量,其中之一是连接字符串 ( cnn
) 以连接到 SQL Server。
以下是来自的(旧)连接字符串GLOBAL.ASA
:
Sub Application_OnStart
Dim cnnDem, cnnString
Set cnnDem = Server.CreateObject("ADODB.Connection")
cnnDem.CommandTimeout = 60
cnnDem.Mode = admodeshareexclusive
cnnString = "Provider=SQLOLEDB; Data Source=192.xxx.x.xx; User Id=xxxx; Password=xxxxx; default catalog=xxxxxxx;"
Application("conString")=cnnString
Call cnnDem.Open(cnnString)
Application("cnn") = cnnDem
End Sub
然后.ASP
页面使用如下cnn
值:
strSQL = "Select * From tblUtilities order by companyname"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strSQL, Application("cnn"), adOpenKeyset
但是,我无法获取连接字符串来连接——我将其缩减为“无法登录”错误消息(无论我尝试了什么登录 ID)。
GLOBAL.ASA
我按如下方式编辑了文件,它可以工作。
Sub Application_OnStart
Dim cnnDem, cnnString
Set cnnDem = Server.CreateObject("ADODB.Connection")
cnnDem.CommandTimeout = 60
cnnString = "Provider=SQLNCLI10.1;User Id=xxxx; Password=xxxxx;Initial Catalog=xxxxxxx;Data Source=xxxxxx\SQLEXPRESS;"
Application("conString")=cnnString
Application("cnn")=cnnString
Call cnnDem.Open(cnnString)
End Sub
主要区别在于它cnn
现在包含连接字符串,而之前cnn
是一个引用ADOBD.Connection
.
我的问题是这会对应用程序产生什么影响(如果有的话)。我已经进行了一些基本(本地)测试,目前一切正常。但是我想知道再次部署该站点时是否可能会出现多用户问题(或类似性质的问题)。