ODBC Excel Driver: Unexpected error from external

2019-01-24 16:02发布

问题:

Since the Windows update from October 10, the ODBC Excel drivers have stopped working. We get the following error when trying to read a file:

"Unexpected error from external database driver (1)"

We open Excel files in Delphi using an ADO connection with the following connection string:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1";

I can get it to work by switching to Microsoft.ACE.OLEDB.12.0, but for that to work, all our customers would have to install the Microsoft Access Database Engine Redistributable on all the computers they use our software on.

Does anybody have another solution or workaround? Thanks in advance.

回答1:

On a customers machine I have deinstalled KB4041681 (Windows 7) which came with last Microsoft Patch. On my machine I have deinstalled KB4041676 (Windows 10). After that Microsoft.Jet.OLEDB.4.0 is now working.

I hope that Microsoft will fix this bug soon.



回答2:

There is one solution. Replace "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1" with Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\MyExcel.xls; Extended Properties=\"Excel 12.0;HDR = YES; After this change you will have to install 2007 Office System Driver: Data Connectivity Components from link on customer machine.



回答3:

I had the same problem with 2 applications developed by me since 3 years (c# and java). Since 10-oct-2017 I couldn't export to excel 2003 but 2007 worked, and couldn't import from excel 2003 but 2007 worked too for import.

In ArcGIS Desktop 10.5.1 By ESRI (a most popular software for Geographic processing) Couldn't open excels 2003 and .mdb files.

Temporally Solution: uninstall KB4041693, KB4041687 in windows 8.1 (maybe for w10).

In microsoft changelog of both path say something about "updates [...] and security updates for microsoft jet". After uninstall and restart all softwares becomes to be normal again.

this problem was introduced in 10-oct-2017. In microsoft forums this problemas was reported (kb4041693 should "fix" it but still doesn't work). Maybe in few weeks they will path (properly) this issue.



回答4:

For me, it worked following these steps:

ps.: We have a Windows Server 2008R2

1 – Download and install this: https://www.microsoft.com/en-us/download/details.aspx?id=23734 2 – Open the .dtsx file and change your Excel connection. On the properties dialog, Click on the three dots in the ConnectionString property and change it to Microsoft Excel 2007. This will automatically change your connection string to: Provider=Microsoft.ACE.OLEDB.12.0;Data Source={YOURPATH};Extended Properties=”Excel 12.0 XML;HDR=YES”; 3 – Some of our .dtsx files point to a config file (usually has a .dtsConfig extension). I also changed these guys to point to the right provider (pretty much copied and pasted the connection string I got from visual studio)

After this, I ran the SQL Job again and it worked fine.



回答5:

If you are working with SSIS package then please change your Excel Sheet version 2003 to 2007 in Excel Source or Excel destination.Generally this issue due to excel version.



回答6:

I had the same problem. Changed Excel 2007 in Excel destinations. It worked. This is same as changing the provider=Microsoft.ACE.OLEDB.12.0.



回答7:

HERE is the solution... i found it in another forum and work perfectly for me... it will works 100%

As mentioned in the following:

https://forums.embarcadero.com/thread.jspa?messageID=902557&tstart=0

https://forum.kanors-emr.org/showthread.php?tid=571&pid=2652#pid2652

The KB4041681 installs version 4.0.9801.1 of msexcl40.dll.

  1. Find prior version (4.0.9801.0) of msexcl40.dll

  2. Place in another directory. They suggest the application directory, but since in the next step you will modify registry to point to this older version, it can probably go anywhere.

  3. Update registry key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Jet\4.0\Engines\Excel\win32 to point to the location from step 2.



回答8:

Uninstall these updates(according to your OS) and your code will start running normally

  • KB4041681 - Windows 7 SP1 and Windows Server 2008 R2 SP1
  • KB4041690 -Windows Server 2012
  • KB4041693 - Windows 8.1 and Windows Server 2012 R2
  • KB4041678 - For me this was the issue

https://support.microsoft.com/en-in/help/4041678/windows-7-update-kb4041678



回答9:

This problem was introduced by a recent update of Microsoft Office. there are not alternative solutions at the moment.