访问 DSN 有哪些访问限制

发布于 2024-07-06 05:20:10 字数 324 浏览 6 评论 0原文

我们将应用程序的一部分作为 Windows 服务运行,它需要能够访问 DSN 才能通过 ODBC 导入。 然而,通过反复试验发现它可以访问的 DSN 似乎存在很多限制。 例如,它似乎不能 1. 访问系统 DSN,除非运行该服务的帐户具有管理员权限。 (尝试连接时出现“拒绝访问”错误) 2. 访问由其他用户创建的用户DSN(这是可以理解的)。 3.通过网络访问文件DSN

我读到文件DSN的目的是允许其他计算机使用它进行连接,但是我似乎无法做到这一点。

那么有谁知道,或者知道我在哪里可以找到使用 Windows 服务时访问 DSN 的所有规则和限制。 谢谢

We are running part of our app as a windows service and it needs to b able to access DSNs in order to import through ODBC. However there seem to be a lot of restrictions found through trial and error on what DSNs it can access. For example it seems that it cannot
1. access a system DSN unless the account that is running the service has admin privileges. (I get an Access Denied error, when trying to connect)
2. access a user DSN that was created by a different user (this one is understandable).
3. access a file DSN across the network

I've read that the purpose of a file DSN is to allow other computers to use it to connect, however i can't seem to make that work.

So does any know, or know where i can find out what all the rules and restrictions on accessing a DSN are when using a windows service.
thanks

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

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

发布评论

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

评论(3

猥琐帝 2024-07-13 05:20:10

您无法使用服务连接到映射驱动器。 映射驱动器必须与称为桌面堆的内存交互,该内存跟踪桌面上的图标。 服务无权访问该内存。 如果必须使用 dsn,请创建一个 systemdsn。 更好的方法是使用连接字符串并将其存储在 app.config 中,并使用加密 api 来加密用户名和密码。

You cannot connect to mapped drives with a service. A mapped drive has to interact with memory called the desktop heap which tracks the icons on the desktop. Services do not have access to that memory. If you have to use a dsn create a systemdsn. better would be to use a connection string and store that in the app.config and use the encryption api to encrypt the user name and password.

背叛残局 2024-07-13 05:20:10

我认为您自己已经发现了三个主要规则。 :-)

除了您可能不需要服务帐户的管理员权限。 IANANA(我不是网络管理员),但您的服务帐户可能只需要对 ODBC 文件或目录之一的读取访问权限。

I think you've already discovered the three main rules yourself. :-)

Except that you probably don't need admin privileges for your service account. IANANA (I am not a network administrator), but your service account probably just needs read access to one of the ODBC files or directories.

莫相离 2024-07-13 05:20:10

这介于#1 和#2 之间:有时正确的文件权限也是必要的。 我曾经在一台 Vista 机器上连接到 DB2 DSN 时遇到了麻烦,因为无论出于什么原因(可能是为了写出临时文件;虽然我不知道为什么它会在这个位置而不是用户特定的位置做这样的事情) ,驱动程序需要对 IBM 安装客户端二进制文件和库的目录进行写访问,该操作由管理员完成,位于 C 驱动器的根目录中。

This is somewhere between your #1 and #2: sometimes correct file permissions are also necessary. I once had troubles on a Vista machine connecting to a DB2 DSN because, for whatever reason (maybe to write out temp files; although I don't know why it would do such a thing in this location instead of a user-specific one), the driver needed write access to the directory where IBM had installed the client binaries and libs, which had been done by an Administrator and was in the root of the C drive.

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