How to resolve "Could not find installable ISAM." error for OLE DB provider "Microsoft.ACE.OLEDB.12.0"
Asked Answered
D

11

22

I am trying to import data from Excel 2007 (.xlsx) files into SQL Server 2008 using a T-SQL OpenRowset() command with the "Microsoft.ACE.OLEDB.12.0" OLE DB provider, and I'm getting a persistent "Could not find installable ISAM" error. All hardware is 32-bit.

[Revised 1/10/12 to try to focus more sharply on the anomalies]

The following T-SQL statement produces the error:

SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',
    'Data Source=C:\work\TestData.xlsx;Extended Properties="Excel 12.0 XML;HDR=YES"',
    'SELECT * FROM [Sheet1$]'
)

If I save the Excel file in the "Excel 97-2003" format (.xls) and use the older Microsoft.Jet.OLEDB.4.0 provider to import the data, it works just fine. This makes me think it is not a security or other environmental issue.

SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 
    'Excel 8.0;Database=C:\work\TestData.xls;HDR=YES', 
    'SELECT * FROM [Sheet1$]'
)

However, when I try the *.xls file with Microsoft.ACE.OLEDB.12.0 provider, which should be backward compatible with the *.xls format, it again fails with the same error:

SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',
    'Data Source=C:\work\TestData.xls;Extended Properties="Excel 8.0;HDR=YES";', 
    'SELECT * FROM [Sheet1$]'
)

Also, interestingly, when I use the SSMS "Import Data..." wizard, it works fine. I saved the Import Data wizard output as an SSIS package and looked in the SSIS file to try to figure out how it works, and it IS successfully using the Microsoft.ACE.OLEDB.12.0 provider. This is the connection string from the SSIS package:

<DTS:Property DTS:Name="ConnectionString">
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\work\TestData.xlsx;Extended Properties="Excel 12.0 XML;HDR=YES";
</DTS:Property>

I've also done the relevant SQL Server configuration to allow the OPENROWSET distributed query:

sp_configure 'show advanced options', 1
reconfigure
GO
sp_configure 'Ad Hoc Distributed Queries', 1
reconfigure
GO

If I also set the following *sp_MSset_oledb_prop* values (which I found in a post somewhere)...

USE [master] 
GO 
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'AllowInProcess', 1
GO 
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'DynamicParameters', 1 
GO 

...then the error changes to "Unspecified error":

OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" returned message "Unspecified error".
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".

However, I am not sure if this an upstream or downstream error. (Is it now finding the "installable ISAM" but failing subsequently?)

I have tried this with multiple Excel files on two different machines/OSes (Windows Server 2003, Windows XP SP3). Both machines are 32-bit.

I've also tried re-installing both the Office 2007 and Office 2010 versions of AccessDatabaseEngine.exe (http://www.microsoft.com/download/en/details.aspx?id=23734 and http://www.microsoft.com/download/en/details.aspx?id=13255, respectively), to no avail.

To summarize:

  • "Microsoft.Jet.OLEDB.4.0" provider works using T-SQL, but "Microsoft.ACE.OLEDB.12.0" does not.
  • "Microsoft.ACE.OLEDB.12.0" works using the "Import Data..." wizard (as far as I can tell from the saved SSIS job file).
  • Setting the "AllowInProcess" and "DynamicParameters" properties to "1" changes the error to "Unspecified error". (Is that a step forward?!)

Any thoughts?

Deposit answered 10/1, 2012 at 2:48 Comment(4)
Have you searched SO for this eeor? There are many questions asking about it, most answers seem to revolve around adding quotes around your Data Source=' ... 'Reduce
Yes,I spent a few hours searching SO and elsewhere, and tried many variations of the connection string, including playing with the quotes, so I don't think that's the issue. (That includes copying the SSIS connection string which is working.)Deposit
The only way I've managed to solve similar problem was to use the MDW file. See hereEnsheathe
Interesting! Thanks for the comment... hope it's of use to others. I don't have the opportunity to re-test I took a different approach and the project is now stale.Deposit
E
1

TRY this it may help you:

set path and strFileType as per requirement

      string connString = "";
//    string strFileType = Path.GetExtension(UpfileName.FileName).ToLower();
//    string path = UpfileName.PostedFile.FileName;

if (strFileType.Trim() == ".xls")
   {

      connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\"";
   }
   else if(strFileType.Trim() == ".xlsx")
    {
            connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\"";
    }
Erosion answered 30/1, 2014 at 9:42 Comment(1)
adding quotation marks to Extended Properties worked for me (like this "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filename + ";Extended Properties=\"Excel 12.0;HDR=YES;\"";)Alienism
R
1

FINALLY, a solution!

Check this out: Msg 7302, Level 16, State 1, Line 1 Cannot create an instance of OLE DB Provider “Microsoft.ACE.OLEDB.12.0” for linked server “(null)”

Basically, you go to

Control Panel > Administrative Tools > Component Services

then expand

Component Services > Computers > My Computer > DCOM Config

find

MSDAINITIALIZE

go to

Properties > Security > Launch and Activation Permissions

click on

Customize > Edit...

add your login name or "Everyone" if you prefer

tick ALL the "allow" boxes for the new user / group

and hit OK on both pages

Now see if your OpenRowSet / OpenDataSource command works

Thanks to Ramesh Babu Vavilla (vr.babu) from social.technet.microsoft.com for the link

Rhinitis answered 19/5, 2014 at 10:30 Comment(3)
All controls in the "Launch and Activation Permissions" are disabled.Zr
@Irawan You need to log into windows as an admin to have access to these settings. Ask your domain admin for access.Rhinitis
I did this, now I no longer get the 7303 or 7399 errors, but my query just gets stuck at "Executing Query" and never finishes. If I try to cancel the query it gets stuck on "Cancelling Query" and never cancels. I have to restart my machine or forcibly close SSMS to get it to stop... So something definitely changed but it still doesn't work. Tried on 12.0 and 16.0 with lots of options.Marenmarena
D
1

This worked for me

Select *
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 
                'text;
                 HDR=yes;
                 imex=1;
                 driver={Microsoft text Driver (*.xls, *.xlsx, *.xlsm, *.xlsb,*.csv)}; 
                 extended properties=excel 12.0 xml; 
                 Database=<path>\', 
                'SELECT * from [<filename>#csv]')
Duron answered 22/8, 2019 at 13:56 Comment(0)
B
0

Try This

SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',
                'EXCEL 12.0;DataBase=C:\TEMP\test.xlsx;Extended Properties="EXCEL 12.0 Xml;HDR=YES', [Sheet1$])
Bookrest answered 26/2, 2013 at 17:1 Comment(0)
P
0
Hai am also faced this situation i solved It

Solved

string ConeectionString = String.Format(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + txtFlp.Text 

    + ";Extended Properties=\"Excel 12.0 Xml;HDR=YES\"");

                OleDbConnection oconn = new OleDbConnection(ConeectionString);</b>
Partner answered 17/9, 2014 at 9:3 Comment(1)
I changed the "Excel12.0" to "Excel 12.0 Xml", because it agrees with what I found here: #15435248 And that also worked for me. Thanks!Counterfeit
T
0

Ensuring quotations around extended properties section of the connection string fixed it for me. I had added an additional property and didn't migrate the quote to the end after my new property.

Tadio answered 11/7, 2018 at 17:53 Comment(0)
H
0

I had the same problem I looked at SSIS package code which was running successfully. I noticed that 16 and 12 (Versions of OLEDB and Excel) are exchanged there in comparison to our code! This worked for me:

OPENROWSET('Microsoft.ACE.OLEDB.16.0','Excel 12.0;Database=...
Hague answered 19/6 at 10:33 Comment(0)
F
-1

I think the answer is hiding in the SSIS package info you posted. The new file format xlsx, stores the data in XML format instead of the old format. Look at it again. It reads... Extended Properties="Excel 12.0 XML;HDR=YES

Don't miss that XML after the standard stuff. (For what it's worth, I also read that you need "Excel 12.0 Macro" to connect with an xslm file.)

Give it a try. Weird but hopefully it works.

Fennelly answered 27/4, 2012 at 18:16 Comment(1)
The first code snippet above includes the Extended Properties="Excel 12.0 XML;HDR=YES" that you suggested-- still doesn't work.Deposit
L
-1

i've resolved with this query:

SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 
    'Excel 12.0;HDR=NO;Database=D:\Filename.xlsx;', 
    [SheetName$])

It seems sql doesn't like the "Extended Properties" section...

Leucopoiesis answered 29/5, 2013 at 8:2 Comment(0)
S
-1

This worked for me:

SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 
   'Excel 12.0;HDR=NO;Database=C:\temp\file.xlsx;',[sheetname$])
Ship answered 18/7, 2017 at 11:27 Comment(0)
C
-2

If you do all this post and continue with te error. try to assign permisiton on the folder pdf, to account

NT Service\MSSQLSERVER
NT Service\SQLSERVERAGENT

works for me

Corves answered 30/7, 2018 at 18:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.