Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens if limit of Sql Server Compact Edition is reached?

What happens if a database reaches the limit of 4GB of the SQL Server Compact Edition? Is there a special exception for this?

Can I safely catch this event or exception and, let's say, create a new database?

like image 740
flash Avatar asked Jun 06 '11 15:06

flash


People also ask

Is SQL Server Compact free?

It includes both 32-bit and 64-bit native support. SQL CE targets occasionally connected applications and applications with an embedded database. It is free to download and redistribute.

What is SQL Server Compact used for?

SQL Server Compact 3.5 SP2 is an embedded database that allows developers to build robust applications for Windows desktops and mobile devices.

How do I allocate more memory to SQL Server?

In Enterprise Manager, right-click on the desired SQL Server instance and click Properties. In the properties dialog box, click the Memory tab. Under the Maximum (MB) slider option, move the slider to the desired maximum value. Click OK to save your changes.


1 Answers

I have not experienced this myself, but it looks like a SqlCeException will be thrown and the NativeError property of the contained SqlCeError will have an error code of 25104 (SSCE_M_DATABASETOOBIG).

Here's a listing of SqlCeError Native Codes related to db engine errors -- the one about the db file being too big is about 2/3 of the way down. The listing is for SQL CE 3.5; you didn't specify what version you were using, but I'm guessing that it wouldn't change.

I don't see why you couldn't catch this exception and then create a new database in your catch section.

try {
  //do something
} catch (SqlCeException cexc){
  foeach (SqlCeError aError in cexc.Errors) {
    if (aError.NativeError == 25104) {  //this is the code for the TOO BIG error code
      //handle too big error -- maybe create a new database
    }
  }
}

I hope this helps!

like image 187
David Hoerster Avatar answered Oct 25 '22 02:10

David Hoerster