gpt4 book ai didi

sql-server - SQL Server 链接服务器到 Microsoft Access

转载 作者:行者123 更新时间:2023-12-02 22:47:47 24 4
gpt4 key购买 nike

我尝试通过执行以下操作来使用 SQL Server 2008 中的链接服务器来 Access Microsoft Access 2003 表。

EXEC sp_addlinkedserver access1t, 'OLE DB Provider for Jet', 'Microsoft.Jet.OLEDB.4.0', 'C:\tester.mdb'
EXEC sp_addlinkedsrvlogin access1t, FALSE, Null, Admin, Null
GO
CREATE VIEW TI001APCE1265 AS SELECT * FROM access1t...Table1

但是,我收到错误:

OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "access1t" returned message "Unspecified error".
Msg 7303, Level 16, State 1, Procedure TI001APCE1265, Line 1
Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "access1t".

我的 Access 数据库上没有密码/用户名,但查看文档后我明白我必须像上面一样使用 sp_addlinkedsrvlogin 。我也试过没有登录。

我仍然遇到同样的错误 - 这是怎么回事?!

谢谢大家

调试输出

Array ( [0] => Array ( [0] => 42000 [SQLSTATE] => 42000 [1] => 7303 [code] => 7303 [2] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "access1265293168". [message] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "access1265293168". ) [1] => Array ( [0] => 01000 [SQLSTATE] => 01000 [1] => 7412 [code] => 7412 [2] => [Microsoft][SQL Server Native Client 10.0][SQL Server]OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "access1265293168" returned message "Unspecified error". [message] => [Microsoft][SQL Server Native Client 10.0][SQL Server]OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "access1265293168" returned message "Unspecified error". ) )

最佳答案

您尝试过命名参数吗?:

EXEC sp_addlinkedserver 
@server = 'access1t',
@provider = 'Microsoft.Jet.OLEDB.4.0',
@srvproduct = 'OLE DB Provider for Jet',
@datasrc = 'C:\tester.mdb'
GO

您可能只需要用单引号括起来的服务器名称'access1t'

[您登录的用户是否有权限 Access C:盘根目录? ]

关于sql-server - SQL Server 链接服务器到 Microsoft Access,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2200503/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com