views:

33

answers:

2

I’m attempting to query and Excel spread sheet on a network share, using the openrowset function with no success. I get the following error:

SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 
    'Excel 8.0;DATABASE=\\server\Xdrive:\Spreadsheet.xls',
    'Select * from [Sheet1$]')

Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error. The provider did not give any information about the error.
OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0' IDBInitialize::Initialize returned 0x80004005: The provider did not give any information about the error.].

I have searched the site and have tried different syntax with no success. I have read that the account may not have access to the network share. What account does this process run under?

A: 

0x80004005 very much looks like Access Denied.

You can look in the services.msc what account the SQL Server runs under. A local account will not work outside of the local machine, a Domain account is the better choice if you want to access resources on the network.

An exception is the NetworkService account (available on Windows 2003 and higher). It is a local account that can access the network, it acts as the machine account (DomainName\MachineName$) in this case. I would recommend a dedicated domain account nevertheless.

Tomalak
What do you mean under " NetworkService account (available on Windows 2003 and higher)". I have it on Windows XP Pro. It is not correct that "A local account will not work outside of the local machine,"
vgv8
Local System account will not
vgv8
@vgv8: Windows XP and Windows 2003 are the same in my book. "Network Service" it is not available as an account in Windows 2000 and below. Since in Windows 2000 most services run as "Local System", they cannot access the network at all. Windows XP/2003 fixed that by introducing a local account named "Network Service" with basic network access capabilities.
Tomalak
A: 

I would use network share but not mapped drives since I always thought that they are creating sessions per each user.

It would not cause access error but you probably should specify that the first row of sheet be not skipped by reading headers:

  • SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
    'Excel 8.0;DATABASE=\server\ Xdrive: \Spreadsheet.xls ;HDR=NO',
    'Select * from [Sheet1$]')
vgv8