0

In a compact framework .NET 3.5 application running on Windows Mobile 5 we are seeing the following error message being logged:

Could not load database compaction library. Operation has been aborted.
   at System.Data.SqlServerCe.SqlCeEngine.ProcessResults(IntPtr pError, Int32 hr)
   at System.Data.SqlServerCe.SqlCeEngine.Repair(SEFIXOPTION option, String dstConnStr, RepairOption repairOption)
   at System.Data.SqlServerCe.SqlCeEngine.Compact(String connectionString)

in:

SQL Server Compact ADO.NET Data Provider

The application is issuing a command to compact a SQL Server Compact database file and receiving the error response above.

The error message occurs intermittently; sometimes the compact operation will complete and sometimes the error above is logged.

Googling this error message yields some results which suggest a lack of memory (or the right sort of memory) being the cause but this error does not occur consistently across all device platforms. Some Windows Mobile devices from a particular manufacturer never get this error and those from another manufacturer have this error more often than not.

Richard Lucas
  • 630
  • 1
  • 4
  • 15

2 Answers2

1

Looks like this occurs as the result of you issuing some sort of repair option on the database.

Have you tried writing a try...catch block around the operation in question?

It would be helpful to see what code is actually causing the error. Knowing what method is throwing the error can help a lot.

This is really more of a comment, but it was too long to fit in the comment section.

EDIT:

Hi Richard,

I don't suppose this is your question on MSDN, is it? >> LINK << It is from back in 2009.

I also found >> THIS POST << on dbaspot.com that makes reference to a device running out of memory. How much "stuff" is on your development device?

  • Thanks, it's actually a compact operation but I think that the two things amount to the same thing! The stack trace as a result of the calling operating which is enclosed in a try...catch block is given in the body of the question. The connection string passed to the compact operation is a connection string for a database on the device. – Richard Lucas Dec 29 '11 at 08:26
  • See EDIT for newer information. Maybe one of those links will help. –  Dec 29 '11 at 17:16
  • Hi, I think the MSDN link is the same as ErikEJ's suggestion above? I don't think that the issue is running out of memory, I could probably make that clearer in the original post, as this only seems to affect one particularly manufacturers device, another never logs this error and they run the same software. – Richard Lucas Dec 30 '11 at 08:31
1

You must install the .repl cab file on the device, for example: sqlce.repl.ppc.wce5.armv4i.CAB

ErikEJ
  • 40,951
  • 5
  • 75
  • 115
  • Hi, thanks for the response but this isn't the problem, all of the necessary DLL files and etc. are installed on the device. The problem is intermittent rather than this never working. – Richard Lucas Dec 29 '11 at 08:23
  • OK, then it is a memory squeeze error, can maybe be remedied by loading the Compaction library during app_start via loadLibrary – ErikEJ Dec 31 '11 at 12:11