I Have a password-protected access database (.mdb) and sql server 2008 running in windows server 2008 R2 x64.
I installed "Microsost Access Database Engine" and I want to create a linked server to access, but I get this error:
"Cannot start your application. The workgroup information file is missing or opened exclusively by another user".
there is not any *.mdw file on my server.
I'm able to add a linked server to an unprotected database, but not to a protected database.
How can I add a mdw file without install MS access?
or is there any oher way to add a linked server?
USE THIS:
EXEC master.dbo.sp_addlinkedserver #server = N'Access', #srvproduct=N'Access', #provider=N'Microsoft.Jet.OLEDB.4.0',
#datasrc=N'C:\Program Files\ZKTime5.0\att2000.mdb'
EXEC master.dbo.sp_addlinkedsrvlogin #rmtsrvname=N'Access',#useself=N'False',#locallogin=NULL,#rmtuser=N'Admin',#rmtpassword=''
this works for me.
I am okay with the SQL script for creating linked servers:
////////////////Create linked server with no password access file
EXEC master.dbo.sp_addlinkedserver #server = N'linkedserver', #srvproduct=N'Smarthr', #provider=N'Microsoft.ACE.OLEDB.12.0', #datasrc=N'dbpath\file.mdb'
EXEC master.dbo.sp_addlinkedsrvlogin #rmtsrvname=N'LINKEDSVR',#useself=N'False',#locallogin=NULL,#rmtuser=NULL,#rmtpassword=NULL
//////////////////////////Create linked server with access password file
exec sp_addlinkedserver
#server = 'LinkServer',
#provider = 'Microsoft.ACE.OLEDB.12.0',
#srvproduct = 'Access4',
#datasrc = 'dbpath\filename.mdb',
#provstr = ';PWD=yourpassword'
exec sp_addlinkedsrvlogin
#rmtsrvname = 'LinkServer',
#useself = 'FALSE',
#locallogin = null,
#rmtuser = 'Admin',
#rmtpassword = null
Related
I trying to create a linkedServer over sql management studio and a cosmos db.
I already created the system data source and the test is fine:
But after create the linkedServer when i trying to open this error appears :
I'm creating the linke server with the following command :
USE [master]
GO
EXEC master.dbo.sp_addlinkedserver #server = N'DEMOCOSMOS', #srvproduct=N'', #provider=N'MSDASQL', #datasrc=N'CosmosDev'
EXEC master.dbo.sp_addlinkedsrvlogin #rmtsrvname=N'DEMOCOSMOS', #useself=N'False', #locallogin=NULL, #rmtuser=NULL, #rmtpassword=NULL
GO
I am trying to link a remote server using the following commands:
EXEC sp_addlinkedserver
#server='REMOTESERVER', #srvproduct='',#provider='SQLNCLI'
EXEC sp_addlinkedsrvlogin
#useself='FALSE', #rmtsrvname='REMOTESERVER',
#rmtuser='user', #rmtpassword='pwd'
sp_testlinkedserver REMOTESERVER;
Where REMOTESERVER is the value returned on the remote server when I execute SELECT ##Servername
All command execute successfully. However when I view the catalog for my 'linked' server (in SSMS) it is listing the tables in the local server, not the remote. Equally if I run a query
SELECT * FROM [REMOTESERVER].localdb.dbo.localtablename;
It will return a results set from the local server.
Note I have confirmed that remote access is enabled as recommended in https://blogs.msdn.microsoft.com/walzenbach/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008/
Any ideas? Thanks in advance.
Solved this by adding the remote IP address to the sp_addlinkedserver command:
sp_addlinkedserver
#server = N'REMOTESERVER',
#srvproduct=N'SQLNCLI',
#provider=N'SQLNCLI',
#datasrc=N'99.99.99.99'
I have an application that creates and uses its own SQL Server Express database. It worked just fine using SQL Server 2008 Express on Windows 7, but I need to get it to work with SQL Server 2014 Express on Windows 10, and I'm getting an error.
I start with an admin connection string:
connectionString="Data Source=.\SQLEXPRESS2014;Initial Catalog=master;Integrated Security=SSPI"
Then with that connection I create the database by executing:
CREATE DATABASE mobile
ON
( NAME = mobile_dat,
FILENAME = '...\path\mydb.mdf',
FILEGROWTH = 5MB )
LOG ON
( NAME = 'mobile_log',
FILENAME = '...\path\mydb.ldf',
FILEGROWTH = 5MB );
And then I create a user:
CREATE LOGIN xxx WITH PASSWORD = 'xxx', CHECK_POLICY = OFF;
USE mobile
EXEC sp_adduser 'xxx', 'xxx';
EXEC sp_addrolemember 'db_owner', 'xxx';
EXEC sp_addrolemember 'db_accessadmin', 'xxx';
EXEC sp_addrolemember 'db_securityadmin', 'xxx';
EXEC sp_addrolemember 'db_ddladmin', 'xxx';
EXEC sp_addrolemember 'db_backupoperator', 'xxx';
EXEC sp_addrolemember 'db_datareader', 'xxx';
EXEC sp_addrolemember 'db_datawriter', 'xxx';
At which point I disconnect and connect as the new user:
connectionString="Data Source=.\SQLEXPRESS2014;Initial Catalog=mobile;User Id=xxx;Password=xxx;"
This worked fine with SQL Server 2008 Express on Windows 7, but on with SQL Server 2014 Express on Windows 10 I'm getting an error:
Login failed for user 'xxx'.
Any ideas as to what I'm missing?
Do you have mixed mode authentication enabled in the SQL Server Express 2014 installation? It's disabled by default IIRC.
If it is enabled use Microsoft Management Studio to try and login and see what error it gives you.
I have a 32 bit Windows 7 machine.
I am trying to access an excel sheet by creating a linked server in SQL Server 2012.
Below is my error.
Msg 7403, Level 16, State 1, Line 1
The OLE DB provider "Microsoft.ACE.OLEDB.12.0" has not been registered.
The control panel's Programs And Features say the Microsoft Access Database Engine 2010 is available.
How do I solve this issue?
SQL CONNECTION STRING and a QUERY:
EXEC sp_addlinkedserver
#server = 'ExcelServer2',
#srvproduct = 'Excel',
#provider = 'Microsoft.ACE.OLEDB.12.0',
#datasrc = 'D:\MyFTP\Jul19\FAILED\DCSDIM.xlsx',
#provstr = 'Excel 12.0;IMEX=1;HDR=YES;'
SELECT * FROM ExcelServer2...DCSDIM
PROVIDERS:
Install the 64 - bit provider on the server from redis.
Use the above-mentioned provider to invoke the SQL Server which is a 64 - bit executable.
It does not matter what provider you have on the local computer to execute SSMS.
Office11 is the internal name for Office 2003.
Office12 for Office 2007, and
Office14 for Office 2010
After you installed the redis package for Office 2010 you need to change your code as follows:
EXEC sp_addlinkedserver
#server = 'ExcelServer2',
#srvproduct = 'Excel',
#provider = 'Microsoft.ACE.OLEDB.14.0',
#datasrc = 'D:\MyFTP\Jul19\FAILED\DCSDIM.xlsx',
#provstr = 'Excel 14.0;IMEX=1;HDR=YES;'
SELECT * FROM ExcelServer2...DCSDIM
I would like to make a copy of what's on my remote server at xxx.safesecureweb.com.
How do I connect to it from my local SQL Server?
Is the syntax something like:
sp_addlinkedserver
#server='PRODUCTION',
#provider='xxx.safesecureweb.com',
#Username='myUsername',
#Password='myPassword'
What I'm thinking of doing is writing a bunch of insert statements like:
INSERT INTO Test.Table
SELECT * FROM Production.Table
You do not specify the remote user and password in the linked server definition. Linked servers have a separate object that mapps the login of users connected to the local server (the 'locallogin') with remote logins. See Security for Linked Servers. For example, the following maps all local logins on the linked server to the specified MyUserName SQL Login:
exec sp_addlinkedserver 'xxx.safesecureweb.com';
exec sp_addlinkedsrvlogin 'xxx.safesecureweb.com'
, 'FALSE', NULL, 'myUserName', 'myPassword';
You can only map with user/password a remote SQL login. Remote Windows logins (trusted authentication) must use integrated authentication and configure the server for constrained delegation.
Provider should be the client provider you want to use to connect. #datasrc is the servername to connect to.
sp_addlinkedserver
#server='PRODUCTION',
#provider='SQLNCLI', -- sql native client.
#Username='myUsername',
#Password='myPassword',
#dataSrc = 'xxx.safesecureweb.com'
Then, when querying, I believe you need to use a four part name fot the table:
INSERT INTO Test.Table
SELECT * FROM Production.mydatabase.dbo.Table
http://msdn.microsoft.com/en-us/library/ms190479.aspx