LinqToExcel: Problem after windows update (Microsoft.Jet.OLEDB.4.0 no longer works)

Hi team,

Today I update my Windows and after this, my test with LinqToExcel fails. Is any have the same problem?

Error log:
Controllers\Cargas\InformeDeCargasController.cs(81,51): warning CS0429: Se ha detectado un código de expresión al que no se puede tener acceso [D:\CruiseControl.NET\builds\TransoftWEBDesarrollo\src\Web\Web.csproj]
--
Controllers\Cargas\InformeDeCargasController.cs(82,51): warning CS0429: Se ha detectado un código de expresión al que no se puede tener acceso [D:\CruiseControl.NET\builds\TransoftWEBDesarrollo\src\Web\Web.csproj]
Error Message:
Test method Infraestructura.Test.Readers.LecturaDeMDTArchivoExcelTest.VerificaLaLecturaDeTodosLosCampos threw exception:
System.InvalidOperationException: Error en la lectura del archivo. Verifique que contenga todas las columnas requeridas.
Stack Trace:
en Infraestructura.Readers.LectorXLSMovimientosDepositoDeTerceros.LeerYRetornarEnumerator() en d:\CruiseControl.NET\builds\TransoftWEBDesarrollo\src\Infraestructura\Readers\LectorXLSMovimientosDepositoDeTerceros.cs:línea 73
en Infraestructura.Readers.LectorXLSMovimientosDepositoDeTerceros.GetEnumerator() en d:\CruiseControl.NET\builds\TransoftWEBDesarrollo\src\Infraestructura\Readers\LectorXLSMovimientosDepositoDeTerceros.cs:línea 81
en Infraestructura.Test.Readers.LecturaDeMDTArchivoExcelTest.VerificaLaLecturaDeTodosLosCampos() en d:\CruiseControl.NET\builds\TransoftWEBDesarrollo\src\Infraestructura.Test\Readers\LecturaDeMDTArchivoExcelTest.cs:línea 50
Error Message:
Test method Infraestructura.Test.Readers.LecturaArchivoExcelTest.LeeArchivoExcel threw exception:
System.Data.OleDb.OleDbException: Error no esperado desde el controlador de la base de datos externa (1) .
Stack Trace:
en System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
en System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
en System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
en System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
en System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
en System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
en System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
en System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
en System.Data.OleDb.OleDbConnection.Open()
en LinqToExcel.Query.ExcelQueryExecutor.GetDataResults(SqlParts sql, QueryModel queryModel)
en LinqToExcel.Query.ExcelQueryExecutor.ExecuteCollection[T](QueryModel queryModel)
en LinqToExcel.Query.ExcelQueryExecutor.ExecuteSingle[T](QueryModel queryModel, Boolean returnDefaultWhenEmpty)
en LinqToExcel.Query.ExcelQueryExecutor.ExecuteScalar[T](QueryModel queryModel)
en Remotion.Data.Linq.Clauses.StreamedData.StreamedScalarValueInfo.ExecuteScalarQueryModel[T](QueryModel queryModel, IQueryExecutor executor)
en Remotion.Data.Linq.Clauses.StreamedData.StreamedScalarValueInfo.ExecuteQueryModel(QueryModel queryModel, IQueryExecutor executor)
en Remotion.Data.Linq.QueryModel.Execute(IQueryExecutor executor)
en Remotion.Data.Linq.QueryProviderBase.Execute[TResult](Expression expression)
en System.Linq.Queryable.Count[TSource](IQueryable`1 source)
en Infraestructura.Test.Readers.LecturaArchivoExcelTest.LeeArchivoExcel() en d:\CruiseControl.NET\builds\TransoftWEBDesarrollo\src\Infraestructura.Test\Readers\LecturaArchivoExcelTest.cs:línea 44
Test Run Failed.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 30

Most upvoted comments

Investigating now: Error happens upon opening the connection. There are no more details sadly and i’m no expert on OLEDB / JetEngine, but according to wikipedia ACE 12 supports everything that OLE 4 does, so shouldn’t it be possible to simply switch ExcelUtilities.cs Line 48

else
            {
                if (args.DatabaseEngine == DatabaseEngine.Jet)
                {
                    connString = string.Format(
                        @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=""Excel 8.0;HDR=YES;IMEX=1""",
                        args.FileName);
                }
                else
                {
                    connString = string.Format(
                        @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 12.0;HDR=YES;IMEX=1""",
                        args.FileName);
                }
            }

to

else
            {
                    connString = string.Format(
                        @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 12.0;HDR=YES;IMEX=1""",
                        args.FileName);
            }

If you have access to the source code of the application using linqtoexcel, you could also define the Engine when creating the ExcelQueryFactory like this: using (var eqf = new ExcelQueryFactory(@"") { DatabaseEngine = DatabaseEngine.Ace })

i’ll try to run the tests in a second to find out if there is any case that does not work with the solution.

Even if the database engine is defined as Ace, when “GetWorksheetNames” or “GetColumnNames” is called it’s defaulting back to the Jet engine…causing it to fail again. For now, we can use a custom build of the library.

This blog article popped up about this issue. It does confirm that this was an unintentional breakage, and that Microsoft is working on a fix:

This update (released October 10th, 2017) includes a security update release that inadvertently affects the JET provider

Apart from this, Microsoft is working on a resolution and will provide an update in an upcoming release of the security patch. This is expected to be available in another 2-3 weeks or earlier.

The article of course recommends switching to ACE since Jet was deprecated 15 years ago. To me it doesn’t make sense to hack LinqToExcel to try to switch its default to use ACE instead of Jet. It makes more sense to completely remove support for Jet, and make ACE a hard requirement. Because this move removes support for a technology (in a sense), I think this should be a LinqToExcel version 2.0 sort of thing.

Look for a new release of LinqToExcel in the near future.

Hmmm… looks like other people are having issues with these recent patches (i.e. Microsoft broke something).

My recommendation would be to uninstall the following patch(es):

OS Patches
Windows 7 KB4041678, KB4041681
Windows 8.1 KB4041693, KB4041687
Windows Server 2008 R2 KB4041678, KB4041681
Windows 10 KB4041676, KB4041691
Windows Server 2016 KB4041691

Translated from German from here:

JET DB engine, Office shortcuts

In the blog there is this comment , which indicates that Excel files can no longer be linked to Access.

Since the last windowsupdate 10.10.2017, it is no longer possible to link excel files to Access 2000, or to open linked excel files

Since the last Windowsupdate 10.10.2017, it is no longer possible to link Excel files with Access 2000 or to open linked EXCEL files with Access 2000.

And in this comment there is a confirmation or a reference to an Excel database error.

Hello DKPrince, we probably have the same problem here. On all Windows 7 computers, we process address databases here, the database .xls can not be >> opened everywhere, since it is said to have no data fields.

In Excel itself, the address lists can be opened without problems, only if we want to link you for the serial letter creation comes a database error.

With .xlsx it goes immediately and with a conversion into a .csv it goes likewise. But we need machine-engineering .xls lists and this is a violent problem.

If someone has a solution, I am grateful for every tip. Which patch do you have to uninstall again and how do you do it best?

The security updates for Windows 7 / 8.1 (October 2017) , the blog post, mentions that Microsoft patches the Microsoft JET Database Engine with KB4041681 and KB4041678 (Windows 7) as well as Update KB4041693 and KB4041687 (Windows 8.1). This is to close the following safety gaps.

  • CVE-2017-8717 - Microsoft JET Database Engine Remote Code Execution Vulnerability
  • CVE-2017-8718 - Microsoft JET Database Engine Remote Code Execution Vulnerability

In this heise.de forum post , however, a user complains that the Excel access in C # over Microsoft.Jet.OLEDB.4.0 no longer works. The error 0x80004005 (denied access) is reported when accessing the database driver in System.Data.OleDb.OleDbException . Also at askwoody.com there is this comment , which complains a broken Microsoft.Jet.OLEDB.4.0 database interface. No XLS files can be imported into an application (see also this article ). I am currently telling you that the problem for the above problems is to be found here.

Also here:

Problem importing XLS files

If you 're looking at problems importing XLS files into your applications, you are not alone. See this anonymous post on AskWoody:

Windows 7 for x64-based Systems KB4041681 and 2017-10 Security Only for Windows 7 for x64-based Systems KB4041678.

Yesterday we got bombarded with the problem that we can not import to xls file into our application, which we have been doing since forever. It gives an error: Unexpected error from external database driver (1). We dug deeper and discovered

Provider = Microsoft.Jet.OLEDB.4.0; DataSource = {0}; ExtendedProperties = \ "Excel 8.0; HDR = Yes; IMEX = 1 \"

Does not work anymore. After all, we’ll get back to normal.

More here:

Per October 10, 2017—KB4041681 (Monthly Rollup)

Security updates to Microsoft Windows Search Component, Windows kernel-mode drivers, Microsoft Graphics Component, Internet Explorer, Windows kernel, Windows Wireless Networking, Microsoft JET Database Engine, and the Windows SMB Server.

Per October 10, 2017—KB4041678 (Security-only update)

Security updates to Microsoft Windows Search Component, Windows kernel-mode drivers, Microsoft Graphics Component, Internet Explorer, Windows kernel, Windows Wireless Networking, Microsoft JET Database Engine, and the Windows SMB Server.

So, both potentially are the cause.

Hi @streppelchen, I tried your solution 2 which to modify source code, it works for me. Thank you so much!

Ok, thanks. I will see if I can reproduce the issue.