SSCE_M_DATABASETOOBIG NativeError 25104 Handling Before it throws

Unanswered SSCE_M_DATABASETOOBIG NativeError 25104 Handling Before it throws

  • Tuesday, November 06, 2012 8:10 PM
     
     

    I need to handle the SQLCE Native Error 25104 corresponding to Database Too Big error.  My application logs entries to the SQL CE 4.0 database and I have max database size set to 4091 (allowed max MB).  I would like to gracefully handle the Database Too Big error before it reaches to 4091 MB. 

    Is there any way other than the file size to know I am reaching the threshold of the max database size?

    What I would like to put a record inside the database table entry that says, this database file size is too big.  After, the max db error, nothing can be written to the database.

    Any ideas?

All Replies

  • Wednesday, November 07, 2012 2:33 AM
    Moderator
     
     

    Hi schiluveru,

    According to your description, you can write some C# code to catch this exception and then insert a warning message to the database in the ‘catch’ section. For more details, please refer to this similar thread.

    TechNet Subscriber Support
    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.


    Ray Chen

    TechNet Community Support

  • Wednesday, November 07, 2012 3:23 PM
     
     

    Hi Chen,

    Thanks Chen for the reply.

    The problem is that you can catch the exception, but you cannot add any record to the database (because adding new record will increase the database size) as it raises the same exception SSCE_M_DATABASETOOBIG.

  • Thursday, November 08, 2012 2:41 AM
    Moderator
     
     

    Hi Chen,

    Thanks Chen for the reply.

    The problem is that you can catch the exception, but you cannot add any record to the database (because adding new record will increase the database size) as it raises the same exception SSCE_M_DATABASETOOBIG.


    Hi schiuveru,

    Thanks for update.

    You can first create a temp table in the database, and insert an initial warning message into the table. And when the exception is raised, you can update the warning message with same size in the ‘catch’ section.


    Ray Chen

    TechNet Community Support

  • Monday, November 12, 2012 5:34 PM
     
     

    Hi Chen,

    Thanks for the reply.  Updating existing database table data (even if the  new size is smaller), the same exception SSCE_M_DATABASETOOBIG raises.  Also, with multiple attempts to update existing data, the process terminates unexpectedly (Its not always, but random).

     I did a similar implementation as follows:

    1) Add dummy rows data to a temp table to pre-allocate table space of approx. 6MB.

    2) Upon SSCE_M_DATABASETOOBIG exception handling,

          a) Delete the pre-allocated dummy rows  inserted above.  (Now the database size falls within the size limits to add small inserts/updates to succeed)

          b) Log the error message related to database too big.

    3) Additional table updates to finish the processing information(which does not need extra space).

    Some times after step 2(a), step 2(b) fails occasionally with SSCE_M_DATABASETOOBIG, but no process termination seen