This article was previously published under Q296711
When you run a query by using the OPENROWSET function against a Jet database, this error message occurs:
Server: Msg 7399, Level 16, State 1, Line 1 OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error. [OLE/DB provider returned message: Unspecified error]
This problem also occurs with any linked server query that uses the Jet provider, such as the OPENQUERY function or the Transact-SQL query with four-part names.
The Jet engine needs to create temporary files. To create the temporary files, the Jet engine uses the TEMP and TMP system environment variables. If the TEMP and TMP system environment variables do not exist, Jet uses the %WINDIR% folder. If the SQL Server service account does not have permissions to create, write, delete and read files in the %WINDIR% folder, or to the folder pointed to by the TEMP or TMP system environment variable, the error occurs.
To work around this problem, use of the the following two methods.
Configure the TEMP and TMP system environment variables to point to a folder (for instance, C:\TEMP).
Set the permissions to the SQL Server service account on this folder as Full Control.
Restart the server.
Note In addition to granting full control to the SQL Server service account, any user that connects to the computer that is running SQL Server by using Windows Authentication must also be granted full control to the same TEMP and TMP directories that the SQL Server service account uses. Before you instantiate the OLEDB provider, SQL Server impersonates the account that is connecting to the computer that is running SQL Server if it is using a trusted connection.
If there is not a TEMP or TMP system environment variable, set the permissions to the SQL Server service account on the %WINDIR% folder as Full Control -or-
Make the SQL Server service account a member of a group that has such permissions on the %WINDIR% folder.