Solved

How to create a SQL Server Linked Server to MS Access

Posted on 2012-04-02
5
339 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
  • 3
5 Comments
 
LVL 15

Assisted Solution

by:deepakChauhan
deepakChauhan 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now