(Print this page)

Error "Unexpected error from external database driver (1)" after Windows Updates
Published date: Monday, October 16, 2017
On: Moer and Éric Moreau's web site

Many data import processes that have been running for years stopped working last night. All this because I applied some Windows Updates on the server yesterday. And apparently I am not alone (https://social.technet.microsoft.com/Forums/en-US/45ebe780-967e-4748-a146-9ec7a15626dc/unexpected-error-from-external-database-driver-1?forum=itmanager)!

The error reads as: Unexpected error from external database driver (1).

I had this issue with some (not all the files). I am writing some notes here as I am still using some librairies I wrote article about in the previous years and found an easy way to fix the issue without having to roll back the Windows Update (as many site reports).

My first error was in a process using the FileHelpers library (http://emoreau.com/Entries/Articles/2011/11/Using-the-FileHelpers-Library.aspx). For some reason, the csv file provided by a third party is containing a pair of double-quotes at the end of the file. In that case, I just needed to add an additional attribute named ConditionalRecord at the top of the class defining my file to ignore that line and my problem was solved:

<DelimitedRecord(","), IgnoreFirst(1), IgnoreLast(1), IgnoreEmptyLines(), ConditionalRecord(RecordCondition.ExcludeIfBegins, """")>

My second issue occurred in a process using LinqToExcel (http://emoreau.com/Entries/Articles/2013/07/A-free-LINQ-to-Excel-and-CSV-provider.aspx). It was even simpler to fix. Just by changing the engine from the default Jet to Ace, my issue got magically solved (as shown in https://github.com/paulyoder/LinqToExcel/issues/124):

Dim book = New LinqToExcel.ExcelQueryFactory(pFile)
book.DatabaseEngine = DatabaseEngine.Ace 

(Print this page)