How to setup a linked server to Access 2000 database? - sql-server-2005

I am using SQL 2005 Server Express.
How can I setup a linked server to an MS Access 2000 database?

Take a look at sp_addlinkedserver in Books Online.
EXEC sp_addlinkedserver
#server = 'linked server name',
#srvproduct = 'Access',
#provider = 'Microsoft.Jet.OLEDB.4.0',
#datasrc = 'C:\path\file.MDB';
You may also need to use sp_addlinkedsrvlogin to associate a user/login with the linked server. Also, if you are using Access 2007, you may need to use an alternate provider:
#provider = 'Microsoft.ACE.OLEDB.12.0',
And finally, if you are on a 64-bit operating system, you may run into issues.

Related

Create a Linked Server Using a Windows Account in SQL Server

There are multiple applications on SQL Server which I am trying to connect to from a Single SQL Server. Instead of creating multiple SQL User ID we thought of creating a single Windows Service Account and use that to connect to other SQL Servers.
The issue is I dont know if I can configure a Linked Server to take the credentials of a Windows Service account.
Points:
Access has been given to the Windows user account
SQL Servers are on Different domains
Is there a best approach to read from multiple sources within the organization other than linked servers?
Update:
Please find below code I am trying to use to create a Linked Server:
USE [master]
GO
EXEC sp_addlinkedserver
#server=N'serverinstance',
#srvproduct=N'',
#provider=N'SQLNCLI',
#datasrc=N'serverinstance.domain.local';
GO
EXEC master.dbo.sp_addlinkedsrvlogin #rmtsrvname = N'serverinstance'
, #useself = N'TRUE'
, #locallogin = N'Domain\NTAccount'
--, #rmtuser = N'user'
--, #rmtpassword = N'pass'
GO
The linked server still fails. I do not want to use any SQL Server User Auth.
I think you need to setup a trust between the 2 domains and make sure the firewall is letting you access the linked server.
It can be either.
https://technet.microsoft.com/en-us/library/ms188477(v=sql.105).aspx
Authentication works the same regardless of if you use Sql or NT Domain authentication.

Create a linked server on a remote server ? SQL Server 2008

I'm trying to create a linked server on a remote server. I know how to create it on the same server that I run the script in .
EXEC master.dbo.sp_addlinkedserver #server = #name, #srvproduct=N'oracle', #provider=N'MSDAORA', #datasrc= #sursadate
EXEC master.dbo.sp_addlinkedsrvlogin #rmtsrvname=#nume,#useself=N'False',#locallogin=NULL,#rmtuser=#username,#rmtpassword=#password
but how can I define that I want the linked server to be created on another server also using a script that I run it on the server I am on (not the same one that i want the linked server to be created on)? Is there a way to define an ip adress to where it should be created?
To be more clear for example: I'm running a script on a server 0.0.0.1, but I want the linked server to be created on another server 0.0.0.2
Unless you already created db server 0.0.0.2 as linked server into 0.0.0.1
then you only you can run this on 0.0.0.1.
EXEC [linked_server_name_for_0.0.0.2].master.dbo.sp_addlinkedserver #server = #name, #srvproduct=N'oracle', #provider=N'MSDAORA', #datasrc= #sursadate
EXEC [linked_server_name_for_0.0.0.2].master.dbo.sp_addlinkedsrvlogin #rmtsrvname=#nume,#useself=N'False',#locallogin=NULL,#rmtuser=#username,#rmtpassword=#password

SQL Server 2008 linked server connection string setup

I'm trying to setup a linked server to another instance of SQL Server installed on the same Windows Server. In the SQL Server Management Console I have both instances added and I'm trying to do a insert from one database into another. I setup the linked server using the query below and I'm getting the following failure message when I test the connection of the the linked server. Can someone help me solve this problem?
USE master
GO
-- To use named parameters:
EXEC sp_addlinkedserver
#server = 'Server Name', --actual server name
#srvproduct = '',
#provider = 'MSDASQL',
#provstr = 'DRIVER={SQL Server};SERVER=Database name;UID=test_user;PWD=test_pwd;'
GO
Error message
Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "Server Name".
OLE DB provider "MSDASQL" for linked server "Server Name" returned message "[Microsoft] [ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect()).".
OLE DB provider "MSDASQL" for linked server "Server Name" returned message "[Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied.". (.Net SqlClient Data Provider)
exec sp_addlinkedserver #server='servername';
exec sp_addlinkedsrvlogin #rmtsrvname='servername',#useself=false, #rmtuser='sa', #rmtpassword='Password';
if sql server is a named instance then servername\instancename

SQL to Access linked server

I am trying to add a linked server to a Access database. I am using the following SQL code to do this.
exec sp_addlinkedserver
#server = 'Test',
#provider = 'Microsoft.Jet.OLEDB.4.0',
#srvproduct = 'OLE DB Provider for Jet',
#datasrc = '\\srv\public$\CM Database\Data\sysConfig_dat.mdb'
go
EXEC sp_addlinkedsrvlogin Test, FALSE, Null, Admin, Null
but when i run this...
select * from Test...tblProduct
i get this 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. what
am i doing wrong?
I am using SQL Server Management Studio 2008 on a 32 bit system.
I figured it out...
The server running SQL Server is a 64Bit machine. The typical data connectivity component drivers did not work with this machine (ie the download that installs the Microsoft.Jet.OleDB.4.0 as a provider). I had to download the components for Access 2010 which has a 64Bit option.
Download from here
That installs the Microsoft.ACE.OLEDB.12.0 as a provider and I can use the SQL command that BradBenning mentioned in his post.
Try using the Microsoft ACE OLEDB provider:
EXEC sp_addlinkedserver
#server = 'Test'
,#provider = 'Microsoft.ACE.OLEDB.12.0'
,#datasrc = '\\srv\public$\CM Database\Data\sysConfig_dat.mdb'
,#srvproduct='Access'
GO

SQL Server not configured for data access

I'm running a SQL Server 2005 database from a VB 6 Application. I connect to the database
through an ODBC DSN.
I renamed the computer on which I'm running the default instance of SQL server from 'Software' to 'IT'. I then ran the sp_dropserver and sp_addserver stored procedures to rename the instance.
On restarting the SQL Server service, the server was able to pick up on the new SQL Server name.
After configuring the ODBC data source name to the new name, the connection was Ok. I'm able to run my application and read records through ADO record sets. However I'm unable to update any recordset using the .Update method. I get the following error instead ... SQL Server not configured for data access
How can I enable data access on the renamed server instance?
How to: Rename a Computer that Hosts a Stand-Alone Instance of SQL Server 2005
You should be able to run this but not against any linked server. It's not a linked server. It's local.
EXEC sp_serveroption 'YourServer', 'DATA ACCESS', TRUE
Just go to the linked server properties > Server options > Data access --> true
Works on SQL Server 2014.
Regards
I just would like to add to the previous answers that, at least in my case here, I needed to enable data access in both places.
for instance:
there is server A and server B
On server A
I have a linked server LB that links me from server A to server B
I need to execute the following:
-- on server A
exec sp_serveroption 'LB', 'data access', 'true'
-- on server B
exec sp_serveroption 'B', 'data access', 'true'
with this
use master
go
exec sp_serveroption 'server name', 'data access', 'true'
go
linked servers generated for replication still showing same error
I've just come across this error and found that it was caused by me trying to run OpenQuery against the local server (doh!). Changing the server name to that of an actual linked server resolved my issue.