Tuesday 4 October 2011

Error 7399 When You Run a Linked Server Query That Uses the OLE DB Provider for Microsoft Jet


You may get the following errors when you run a query on a Linked Server that is configured to use OLEDB 4.0 provider for Microsoft Jet:

Error 7399: OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error.
[OLE/DB provider returned message: Unspecified error]
OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0' IDBInitialize::Initialize returned 0x80004005: ].
OR
"Error 7399: OLE DB provider 'MSDASQL' reported an error. Driver's SQLSetConnectAttr failed The Microsoft jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data."


These problems probably occur because the login account does not have access to the temporary folder of the SQL Server startup account, because the linked server query runs in the context of the login account. If you run a linked server query, SQL Server tries to create a temporary file data source name (DSN) in the temporary folder of the SQL Server startup account.

To work around this problem, you could try the following:

1. Log on to the computer by using the SQL Server start up account.
2. Create a folder named Temp in the operating system installation directory.
3. Permit full access to a non-administrator account on the Temp folder.
4. Set the value of the TEMP and TMP user variables of the SQL Server startup account to the newly created Temp folder. To do so, follow these steps:
a. Right-click My Computer, and then click Properties.
b. Click the Advanced tab, and then click Environmental Variables.
c. In the User variables for Logon User list, click TEMP, and then click Edit.
d. In theVariable Value box, type C:\Temp as the location of the new Temp folder, and then click OK.
e. Repeat steps c and d to set the value of the TMP variable.
f. Click OK two times.

5. Log off, and then log on to the computer by using SQL Server startup account.
6. Restart the SQL Server services.


However, I've also experienced that you may get these errors if the datasource (i.e. the file path supplied in the @datasrc parameter of the sp_addlinkedserver query command) does not exist, or is missing. For example, if you forget to copy the file into the folder where the data source parameter of your linked server points to.


http://support.microsoft.com/kb/814398

No comments:

Post a Comment