使用 ODBC DSN 的扩展存储过程

发布于 2024-07-30 05:44:12 字数 538 浏览 1 评论 0原文

我有一个扩展存储过程(用 Delphi 编写,如果这有什么区别的话),它通过 ODBC 建立自己的连接并执行一些处理 - 这些是单独使用 T-SQL 无法完成的。

如果我尝试使用设置的系统 DSN(例如名为 MyDataSource)进行连接,xp 将返回以下错误:

[Microsoft][ODBC SQL Server Driver][SQL Server] 无法打开登录“MyDataSource”中请求的数据库'。 登录失败。

但是,如果我使用连接字符串 (SERVER=MyServerName;DATABASE=MyDatabaseName;etc) 进行连接,那么它会连接 & xp可以工作。

我在 xp 之外测试了代码,只是一个 Windows 应用程序,并且使用 DSN 的连接有效。 我预料到会出现这种情况,因为这与我连接数据库 10 年的方式相同!

所以我让它可以工作,但真的想知道为什么它不能使用 DSN 工作。 我也尝试过使用用户 DSN,但没有区别。

有任何想法吗? 谢谢。

I have an extended stored procedure (written in Delphi if that makes any difference) that makes its own connection via ODBC and performs some processing - stuff that can't be done using T-SQL alone.

If I try to connect using the System DSN that is set up (e.g. named MyDataSource), the xp returns the following error:

[Microsoft][ODBC SQL Server Driver][SQL Server] Cannot open database requested in login 'MyDataSource'. Login fails.

However, if I connect using a connection string (SERVER=MyServerName;DATABASE=MyDatabaseName;etc) then it connects & the xp works.

I tested the code outside of an xp, just a Windows app, and the connection using the DSN worked. I'd expect this as it is the same way I have connected to a database for 10 years!

So I have it working but really want to know why it doesn't work using a DSN. I also tried with a user DSN but no difference.

Any ideas? Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

乜一 2024-08-06 05:44:12

请记住,执行扩展存储过程时,它是在 SQL Server 服务使用的登录名下运行的。 如果该 SQL Server 的登录没有网络权限,则会出现拒绝错误。 我希望这有帮助。

Keep in mind that when the extended stored procedure is executed it is running under the login that the SQL server service is using. If the log in that SQL server does not have permissions on the network then denial errors will occur. I hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文