SQL 访问 ODBC 问题:ODBC--调用失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23253742/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Access ODBC Issue: ODBC--Call failed
提问by user2061929
I created an Access front end for a SQL DB on my PC for use throughout my company. I am using a file ODBC connection and putting both the ODBC file and the Access file on a shared network drive.
我在我的 PC 上为 SQL 数据库创建了一个 Access 前端,供整个公司使用。我正在使用文件 ODBC 连接并将 ODBC 文件和 Access 文件放在共享网络驱动器上。
When I load the access file, for some reason it seems to default to using my windows login credentials and pulls in the data perfectly. When a user attempts to open the file, they receive an error message saying "ODBC --call failed.". I can open the Linked Table Manager for them and check 'ask for new location' then specify the ODBC file and it all works fine...however it doesn't seem to save anything. I get the error each time someone other then myself opens this file.
当我加载访问文件时,出于某种原因,它似乎默认使用我的 Windows 登录凭据并完美地提取数据。当用户尝试打开文件时,他们会收到一条错误消息,指出“ODBC --call failed.”。我可以为他们打开链接表管理器并选中“询问新位置”,然后指定 ODBC 文件,一切正常……但是它似乎没有保存任何内容。每次别人然后我自己打开这个文件时,我都会收到错误消息。
Any idea what could be wrong? I am not an Access guy by trade, it just seems to be the tool we need for the moment.
知道有什么问题吗?我不是交易员,它似乎是我们目前需要的工具。
--EDIT: For Clarification I am using a file ODBC connection
--编辑:为了澄清,我正在使用文件 ODBC 连接
--Edit 2--
--编辑2--
Riddle me this. So I have been troubleshooting this issue and I came across something interesting. I was logged in as one of my users and did the following:
给我这个谜。所以我一直在解决这个问题,我遇到了一些有趣的事情。我作为我的用户之一登录并执行了以下操作:
- Create a new access file that references a file ODBC connection on the desktop.
- Create 3-4 linked tables in the access file, using the ODBC file on the desktop.
- Save and close the access file.
- Re-Open said file.... and I get an ODBC connection error! Right after everything was fine in a fresh file!
- 创建一个新的访问文件,该文件引用桌面上的文件 ODBC 连接。
- 使用桌面上的 ODBC 文件在访问文件中创建 3-4 个链接表。
- 保存并关闭访问文件。
- 重新打开上述文件.... 我收到 ODBC 连接错误!就在新文件中一切正常之后!
Anyone ever experience this?
有人经历过吗?
采纳答案by user2061929
Well, I was able to narrow the issue a bit. Access for some reason keeps trying to use Windows Credentials instead of the username in my ODBC file. I can't find a way around it, but I was able to resolve the issue by creating logins on my SQL Server for the windows users that need access.
好吧,我能够稍微缩小问题的范围。由于某种原因,Access 一直尝试使用 Windows 凭据而不是我的 ODBC 文件中的用户名。我找不到解决方法,但我能够通过在我的 SQL Server 上为需要访问权限的 Windows 用户创建登录来解决该问题。
I am not incredibly happy about needing to manage more logins, but that's what i did to resolve this issue.
我对需要管理更多登录并不感到非常高兴,但这就是我为解决这个问题所做的。
回答by SEM_jmc
i assume you didn't install the ODBC correctly on each users PC.
you should create the ODBC-definition. You can create the relevant statements directly in the registry, see this branch
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI
if you give the same name as on your developer machine, then it works. that's how i do it with my client applications that i develop on my machine and then install it at client site
我假设您没有在每个用户的 PC 上正确安装 ODBC。您应该创建 ODBC 定义。您可以直接在注册表中创建相关语句,请参阅此分支
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI
如果您提供与开发人员机器上相同的名称,则它可以工作。这就是我如何使用我在我的机器上开发的客户端应用程序然后在客户端站点安装它
回答by mark
I don't mean to resurrect the dead, but I had this same error stem from a different issue.
我不是要复活死者,但我有同样的错误源于不同的问题。
I was using an ODBC connection. When running the file using the 'Design' run button it worked fine. When I tried using the Navigation Pane and double clicking on it, the error would happen.
我使用的是 ODBC 连接。使用“设计”运行按钮运行文件时,它工作正常。当我尝试使用导航窗格并双击它时,会发生错误。
The structure of my query was the problem; I was porting a SQL server query over and the single quote ' parameter passing was not well received in Access. Changing these over to double quotes " made it work.
我的查询结构是问题所在;我正在移植一个 SQL 服务器查询,并且单引号 ' 参数传递在 Access 中没有得到很好的接受。将这些更改为双引号 " 使其工作。