简体   繁体   English

SQL 链接服务器到访问数据库

[英]SQL linked server to Access Database

I am trying to create aa Linked Server in SQL (SQL 2016) to an access database (2013).我正在尝试在 SQL(SQL 2016)中创建一个链接服务器到访问数据库(2013)。 I do not want to do anything in access - just simply query a table from SQL Studio Management.我不想在访问中做任何事情 - 只需从 SQL Studio Management 中查询一个表。 I have tried to create an ODBC connection - but I only have the option of 32bit - not 64. But if I create a 32bit (Microsoft Access Driver (*.mdb) and then create a linked server using Microsoft OLE DB Provider for ODBC Driver - Data source I am using the System DSN name I get this message:我试图创建一个 ODBC 连接 - 但我只能选择 32 位 - 而不是 64。但是如果我创建一个 32 位(Microsoft Access Driver (*.mdb) 然后使用 Microsoft OLE DB Provider for ODBC Driver 创建一个链接服务器- 数据源我正在使用系统 DSN 名称我收到此消息:

The linked server has been created but failed a connection test.已创建链接服务器,但连接测试失败。 Do you want to keep the linked server?您要保留链接服务器吗?

=================================== ====================================

An exception occurred while executing a Transact-SQL statement or batch.执行 Transact-SQL 语句或批处理时发生异常。 (Microsoft.SqlServer.ConnectionInfo) (Microsoft.SqlServer.ConnectionInfo)


Program Location:节目地点:

at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType, Boolean retry) at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(String cmd, Boolean retry) at Microsoft.SqlServer.Management.Smo.LinkedServer.TestConnection() at Microsoft.SqlServer.Management.SqlManagerUI.LinkedServerProperties.DoPreProcessExecution(RunType runType, ExecutionMode& executionResult) at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType, Boolean retry) at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(String cmd, Boolean retry) at Microsoft.SqlServer.Management.Smo. Microsoft.SqlServer.Management.SqlManagerUI.LinkedServerProperties.DoPreProcessExecution 上的 LinkedServer.TestConnection()(RunType runType,ExecutionMode& executionResult)

I do have a few other linked servers - but to Oracle DB's.我确实有一些其他链接服务器 - 但到 Oracle 数据库。 Am I missing something?我错过了什么吗?

Well, if your SQL server is running as x64 bits, then you have to install and use a x64 bit copy of Access data engine (ACE).好吧,如果您的 SQL 服务器以 x64 位运行,那么您必须安装并使用 Access 数据引擎 (ACE) 的 x64 位副本。

You can't use MS-access x32 with a x64 bit version of SQL server.您不能将 MS-access x32 与 x64 位版本的 SQL 服务器一起使用。

While a x32 or x64 bit client can easy connect to SQL server?虽然 x32 或 x64 位客户端可以轻松连接到 SQL 服务器? That works because that is a socket connection.这是有效的,因为那是一个套接字连接。

But with Access, it is NOT a socket connection FROM sql server to the ACE data engine.但是对于 Access,它不是从 sql 服务器到 ACE 数据引擎的套接字连接。 There is no "service" you connect to.没有您连接到的“服务”。 So this is a in-process external.dll that is consumed and used directly by SQL server to OPEN the accDB file.所以这是一个进程内的 external.dll 被 SQL 服务器直接消费和使用来打开 accDB 文件。

Hence the bit size of that process that consumes the ACE data engine MUST match.因此,消耗 ACE 数据引擎的进程的位大小必须匹配。 You can install ACE x64 bits data engine on that server, and then this can work.您可以在该服务器上安装 ACE x64 位数据引擎,然后这可以工作。 But SQL server x64 can't use external x32 bit dll's of any kind - including the ACE data engine.但是 SQL 服务器 x64 不能使用任何类型的外部 x32 位 dll - 包括 ACE 数据引擎。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM