1

I have been trying to figure this out for about a half of a day now. I have been trying to run a very simple query on an Access database in SQL Server 2014.

Query:

select * from plantsT

what I have tried.

I tried to run

SELECT *
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'\\path\MasterDatabase.accdb';
'';
'', PlantsT);

Error message:

Cannot create an instance of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".

I have tried all of the options on MSDN

Same error.

I have tried to install access 2007 drivers.

I have tried to link as linked server. I was able to link to access file using this code"

DECLARE @AccessFileName nvarchar(32);
DECLARE @FilePath nvarchar(max);
DECLARE @CombinedPath nvarchar(max);

SET @AccessFileName = N'MasterDatabase.accdb';
SET @FilePath = N'Y:\';
SET @CombinedPath = @FilePath + @AccessFileName;

IF  EXISTS (
     SELECT srv.name 
     FROM sys.servers srv 
     WHERE srv.server_id != 0 
     AND srv.name = N'MasterDatabase' ) 
BEGIN
     EXEC master.dbo.sp_dropserver 
          @server=N'MasterDatabase'
END

EXEC master.dbo.sp_addlinkedserver 
     @server = N'MasterDatabase',  
     @provider = N'Microsoft.ACE.OLEDB.12.0',  
     @srvproduct = N'Access2007', 
     @datasrc= @CombinedPath

I tried to connect to a test database with same path and no luck there either. I have checked permissions and shared that folder with everyone.

I have checked and made sure Access is installed on executing server.

How can I run a query on this db?

I have just found out that i think it is the wrong bit level driver please inform me how to fix or work around.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
JamTay317
  • 1,017
  • 3
  • 18
  • 37

0 Answers0