Solved

How to create a SQL Server Linked Server to MS Access

Posted on 2012-04-02
5
374 Views
Last Modified: 2012-06-27
I need to create a linked server in SQL Server 2008 R2 to a MS Access 2007 database.

Does anyone have any tips?

Thanks,
Steve
0
Comment
Question by:fcsIT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 15

Assisted Solution

by:Deepak Chauhan
Deepak Chauhan earned 250 total points
ID: 37798559
There is two  blck of script both are working fine u can opt whatever is usable for you

1.
USE [master]
GO
EXEC master.dbo.sp_addlinkedserver @server = N'ACCESS', @srvproduct=N'access', @provider=N'Microsoft.ACE.OLEDB.12.0', @datasrc=N'f:\test.accdb'
GO
 
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname = N'ACCESS', @locallogin = NULL , @useself = N'False'
GO

or you can use below template  only put you actual variables it is tested and working fine..

2.
EXEC sp_addlinkedserver
    @server = N'Your Linked Server Name',
    @provider = N'Microsoft.ACE.OLEDB.12.0',
    @srvproduct = N'Access2007',
    @datasrc = N'C:\path\to\your\db.accdb'
GO

-- Set up login mapping using current user's security context
EXEC sp_addlinkedsrvlogin
    @rmtsrvname = N'Your Linked Server Name',
    @useself = N'TRUE',
    @locallogin = NULL,
    @rmtuser = N'Your Linked Server Name',
    @rmtpassword = ''
GO

-- List the tables on the linked server
EXEC sp_tables_ex N'Your Linked Server Name'
GO

-- Select all the rows from table1
SELECT * FROM [Your Linked Server Name]...table1
0
 

Author Comment

by:fcsIT
ID: 37798565
Quick question that I forgot to include in my original post, the Access database is supplied by a third party vendor.  The credentials for accessing it do not include a username, but does have a password.

Everything I've tried says a username is required, but the database itself doesn't have one, it just has the password portion.  Will that work with these options?
0
 

Author Comment

by:fcsIT
ID: 37798607
I just tried to create the linked server using your instructions, but ran into the same creditials problem I've been hitting using every other method.

How can I create a linked server to an Access database that is password protected, but has not username associated with that password?
0
 
LVL 77

Accepted Solution

by:
peter57r earned 250 total points
ID: 37799752
I previously thought this was not possible but seeing your Q I had another look round and came on this..

http://social.msdn.microsoft.com/Forums/en-NZ/sqlgetstarted/thread/11a8b5e5-3f10-41db-bc1a-266cdc0aa072

Look nearly at the end of the thread.
0
 

Author Comment

by:fcsIT
ID: 37802325
Still no luck on this.  I found an article (wish I had copied the URL to it to post here) on Microsoft's site talking about this issue.  They said you have to jump through a lot of hoops to get a user account between the SQL Server and the server the Access db resides on, such as creating a temp directory, assigning it permissions, and several other things.

I'm abadoning this whole process and will either figure out a better way, or just have the users do it manually.

Thanks everyone for your help!
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question