无法访问同一服务器上的重复 SQL Server 数据库
我在 Windows Server 2003 R2 上使用 SQL Server Workgroup Edition。
我的经典 ASP 页面使用系统 DSN 访问我的生产数据库。都在这里工作。
像这样的代码...
<%
dbName= "ProdDB"
userID = "PublicUser"
pwd = "PublicUserPW"
Set objConn = Server.createObject("ADODB.Connection")
objConn.connectionString = "DSN=MySystemDSN"
objConn.open dbName, userID, pwd
%>
ProdDB 在 Enterprise Manager 中创建了 ProdDB 的副本
- 为了开发和测试,我通过备份
- 从 ProdDB 备份集恢复到名为 TestDB 的新数据库
我的理解是,恢复的数据库将包含该数据库的精确副本数据以及用户、角色等。在企业管理器中比较这两个数据库似乎支持了这一假设。
所以...我假设我可以使用相同的凭据访问测试副本,并且只更改 dbName,就像这样...
<%
dbName= "TestDB"
userID = "PublicUser"
pwd = "PublicUserPW"
Set objConn = Server.createObject("ADODB.Connection")
objConn.connectionString = "DSN=MySystemDSN"
objConn.open dbName, userID, pwd
%>
但是,现在我的页面返回
[Microsoft][ODBC 驱动程序管理器] 数据 未找到源名称且无默认值 指定驱动程序
我什至尝试创建一个新的系统DSN,默认数据库指向TestDB。还是没有喜悦。
我确信我正在做一些简单而愚蠢的事情。非常感谢任何帮助。
I am using SQL Server Workgroup Edition on Windows Server 2003 R2
My classic ASP pages access my production database using a system DSN. All working here.
Code like this...
<%
dbName= "ProdDB"
userID = "PublicUser"
pwd = "PublicUserPW"
Set objConn = Server.createObject("ADODB.Connection")
objConn.connectionString = "DSN=MySystemDSN"
objConn.open dbName, userID, pwd
%>
For development and testing, I created a copy of ProdDB in Enterprise Manager by
- Backing up ProdDB
- Restoring from the ProdDB backup set to a new database called TestDB
My understanding was that the restored database would contain an exact copy of the data as well as users, roles etc. Comparing both databases in Enterprise Manager seemed to back up this assumption.
So... I assumed I can access the test copy using the same credentials and only change the dbName, like so...
<%
dbName= "TestDB"
userID = "PublicUser"
pwd = "PublicUserPW"
Set objConn = Server.createObject("ADODB.Connection")
objConn.connectionString = "DSN=MySystemDSN"
objConn.open dbName, userID, pwd
%>
However, now my page returns
[Microsoft][ODBC Driver Manager] Data
source name not found and no default
driver specified
I have even tried creating a new System DSN, with a default database pointing at TestDB. Still no joy.
I'm sure I'm doing something simple and silly. Any assistance gratefully received.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
open 方法 的文档表示它已声明:
所以看起来您是传入
TestDB
作为连接字符串。我通常调用 open 而不指定任何参数。从 connectionstrings dot com 获取连接字符串,并且:The documentation for the open method says it's declared:
So it looks like you're passing in
TestDB
as the connection string. I usually call open without specifying any arguments. Grab a connection string from connectionstrings dot com, and: