Link to home
Start Free TrialLog in
Avatar of Clif
ClifFlag for United States of America

asked on

Access Database As Linked Server?

I'm running SQL Server 2008 SP2
(No idea what version of Access wrote the mdb file, but should be either 2008 or the version just prior)

I have an mdb file (historic data) that I need to read.  Rather than go out and purchase MS Access, I'd like it if I can connect it to SQL Server as a Linked Server.

I used the following code:
EXEC sp_addlinkedserver 
   @server = 'access_test', 
   @provider = 'Microsoft.Jet.OLEDB.4.0', 
   @srvproduct = 'OLE DB Provider for Jet',
   @datasrc =  'C:\Users\Public\Documents\xxxxxx.mdb'
GO

Open in new window

Which seemed to connect to the file with no issue.  However when I click on the folder that should display the files, I get the following error:
OLE DB provider 'Microsoft.Jet.OLEDB.4.0' cannot be used for distributed queries because the provider is configured to run in single-threaded apartment mode. (Microsoft SQL Server, Error: 7308)

Any ideas?

How do I connect an MS Access database to SQL Server as a Linked Server?
Avatar of Ioannis Paraskevopoulos
Ioannis Paraskevopoulos
Flag of Greece image

Hi,

Try this:

sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed Queries', 1;
GO
RECONFIGURE;
GO

Open in new window


and have a look at http://blog.sqlauthority.com/2010/11/03/sql-server-fix-error-ms-jet-oledb-4-0-cannot-be-used-for-distributed-queries-because-the-provider-is-used-to-run-in-apartment-mode/

Giannis
ASKER CERTIFIED SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you just want to review the data you can use the free Access Runtime:

http://www.microsoft.com/en-us/download/details.aspx?id=10910

Install that on a workstation, then locate the .mdb file and doubleclick it. The runtime should open and allow you to review the data in the tables.

of course, if you need to move data into your server database, then you can do as suggested above, or use SSIS to move the data in.
Avatar of Clif

ASKER

jyparask,
I ran across that page myself and tried the recommendation.  It did not work.

Unless, of course, I'm supposed to remove the (failed) link, then run the configuration, then re-attach the Access database.

-----
fyed,
SSMA sounds promising, however I cannot seem to find a download link.  Searching around from the link you provided, I found what looked like a download link, but was lead to a Microsoft page called "Learning Center" and a suggestion that I "Get SQL Server 2012".
Try this link.  Most of the links I had were redirected, but finally found this:

http://www.microsoft.com/en-us/download/details.aspx?id=28763
Avatar of Clif

ASKER

That is perfect.  It's exactly what I needed.

Thanks.