Quantcast
Channel: SQL Archives - SQL Authority with Pinal Dave
Viewing all articles
Browse latest Browse all 594

SQL SERVER – The OLE DB Provider “Microsoft.ACE.OLEDB.12.0” for Linked Server “(null)” Reported an Error. Access Denied

$
0
0

Here is another blog which explains a situation I was in while reading data from excel. In this blog, we would talk about error “Access Denied” error while using The OLE DB provider “Microsoft.ACE.OLEDB.12.0” for linked server.

I was using the following query to read the data from excel. Filename “SQLAuthority.xlsx” and sheet name was “Sheet1”.

SELECT * FROM OPENROWSET(
'Microsoft.ACE.OLEDB.12.0'
,'Excel 12.0;Database=F:\Backup\SQLAuthority.xlsx;HDR=YES'
,'SELECT * FROM [Sheet1$]')

The error message while running the query is as follows.

Msg 7399, Level 16, State 1, Line 1
The OLE DB provider “Microsoft.ACE.OLEDB.12.0” for linked server “(null)” reported an error. Access denied.
Msg 7350, Level 16, State 2, Line 1
Cannot get the column information from OLE DB provider “Microsoft.ACE.OLEDB.12.0” for linked server “(null)”.

If you observe in the image, the path, file name etc. are correct.

SQL SERVER - The OLE DB Provider "Microsoft.ACE.OLEDB.12.0" for Linked Server "(null)" Reported an Error. Access Denied excel-ad-01

Here is the content of the excel file.

SQL SERVER - The OLE DB Provider "Microsoft.ACE.OLEDB.12.0" for Linked Server "(null)" Reported an Error. Access Denied excel-ad-02

Since we can see “Access Denied” in the message, I tried all possible permissions to file, folder, everyone, full control etc. but none helped. I also tried explicit permission to service account NT Service\MSSQLSERVER.

SOLUTION/WORKAROUND

As I mentioned, I checked service account and it was set as NT Service\MSSQLSERVER.

I changed that to Local System as shown below and restarted the service.

SQL SERVER - The OLE DB Provider "Microsoft.ACE.OLEDB.12.0" for Linked Server "(null)" Reported an Error. Access Denied excel-ad-03

And then it started working.

SQL SERVER - The OLE DB Provider "Microsoft.ACE.OLEDB.12.0" for Linked Server "(null)" Reported an Error. Access Denied excel-ad-04

Have you seen this error and found some other solution? If yes, please write in the comment box below to help others.

Reference: Pinal Dave (https://blog.sqlauthority.com)

First appeared on SQL SERVER – The OLE DB Provider “Microsoft.ACE.OLEDB.12.0” for Linked Server “(null)” Reported an Error. Access Denied


Viewing all articles
Browse latest Browse all 594

Trending Articles