Microsoft Access
  Home arrow Microsoft Access arrow Page 2 - Configuring a Linked Microsoft Access Serv...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MICROSOFT ACCESS

Configuring a Linked Microsoft Access Server on SQL 2005 Server
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 46
    2006-06-19

    Table of Contents:
  • Configuring a Linked Microsoft Access Server on SQL 2005 Server
  • Linked Servers on SQL 2005 Server
  • Finding information about Linked Servers
  • Setting linked server options
  • Running a query against the linked server
  • Using the Management Studio to set up a Linked Server

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Configuring a Linked Microsoft Access Server on SQL 2005 Server - Linked Servers on SQL 2005 Server


    (Page 2 of 6 )

    On a SQL 2005 server you can use either the stored procedures or the Management Studio to configure the linked servers. This tutorial will show both of these options. In either case, one needs to know the location of the database file on the external system.

    Using Stored Procedures

    SQL 2005 server makes it easy by providing you with templates. Open the Templates Explorer from the View menu item as shown in the next picture.

    From the templates folder expand the node Linked Server as shown.

    Double click the Add Linked Server Access MDB and you get the following template file, shown in the next picture. Using this as a template you can fashion your script. The first stored procedure, sp_addlinkedserver, adds a linked server to the Management studio. Since this database is external data, the next stored procedure, sp_addlinkedsrvlogin, creates a login from the local server you are working (SQL 2005) to the external database (MS Access database). The next, sp_tables_ex, shows all the tables in the external database. Since the Microsoft Jet OleDB provider does not support the Catalog and Schema, the query can be run against the linked server table using the syntax shown here. The keyword GO is used to submit as a batch.

     

    Setting up the Linked server: an example

    The MS Access 2003 database used for configuring the linked server 'AccessDb' is at the following location on the hard drive: C:Documents and SettingsJayMy Documentsnwind.mdb where nwind is the example database, Northwind.mdb. The following script creates the Linked Server, 'AccessDb'.

    exec sp_addlinkedserver @server='AccessDb',
    @srvproduct='Access',
    @provider='Microsoft.Jet.OLEDB.4.0',
    @datasrc='C:Documents and SettingsJayMy Documents
    nwind.mdb'

    After you execute this procedure in the Query Editor and refresh the Linked Servers node in the Management Studio, you should be able to see this object added to the list of linked servers as shown.

    The next stored procedure adds the 'Admin' as the user to the database. If the variable @useself, which takes the Boolean values true or false is set to true, then the local server logins will use their username and password, and the variables @rmtuser and @rmtpassword will be ignored. When it is set to false, the remote username and password will be used, which for an MS Access database is 'Admin' and no password. Although the template shows that NULL can be passed to the variable @rmtpassword, you will get an error passage if you run a query on this linked server (Msg 137, Level 15, State 2, Line 18 Must declare the scalar variable "@rmtpassword"). In the code shown, which works, an empty string is passed to the variable.

    exec sp_addlinkedsrvlogin @rmtsrvname='AccessDb', 
    @useself='false', 
    @rmtuser='Admin', 
    @rmtpassword=''
    

    More Microsoft Access Articles
    More By Jayaram Krishnaswamy


       · Working on single databases will be mostly for small businesses and anywhere you...
       · Wonder if you have any idea why SQL Server posts a a reference to c:/windows/sytem32...
       · I am Jayaram Krishnaswamy. Somehow the authentication to login to leave a message...
       · I read this with great enthusiasm but was saddened because it does not have an...
       · Hi,Thanks for this article! It is exactly what I want to do. But it doesn't work...
       · Well, my error comes out in english, but I think it matches yours. The handling of...
       · Well, if you find something about this issue, please post and let me know ;)Quân
       · I'm having extreme difficulties making a linked server connect to a Simply...
       · If you are struggling to link to Access 2007 substitute Microsoft.ACE.OLEDB.12.0...
     

    MICROSOFT ACCESS ARTICLES

    - Converting a MySQL Database to an Excel Work...
    - Linking SQL Express 2005 Tables to MS Access...
    - Working with Access Projects in Access 2007
    - Exploring Access 2007
    - Working with Stored Procedures in an MS Acce...
    - Creating and Using Action Queries
    - Creating Data Access Pages with Charts using...
    - Advanced Ideas using VBA
    - VBA Details
    - Updating Records in MS Access
    - Using ADO`s Record Object with URLs
    - Exporting XML from MS Access 2003
    - Importing XML into MS Access 2003
    - On Using Pass-through Queries in MS Access
    - Distributed Queries in MS Access





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek