views:

127

answers:

1

Having had some Sql Compact db corruption issues in the past and gone through the article on these, I got the idea that storing the database sdf file on a storage card significantly increases the risk of data loss due to db corruption.

Do you store the sdf file on a storage card? Have you had any issues caused by it? What should I pay attention to when recommending a particular brand or model of an SD card wrt the stability and security for use with SQL Compact?

+1  A: 

Having the database on a persistent storage volume (whther it's a card or internal Flash) increases the potential for corruption, and it's almost always due to the sleep wake cycle. When the device is suspended, the store is typically unmounted and when it resumes, it is re-mounted. Depending on the OEM implementation, connections may or may not survive that tear-down and build up well (I've seen devices where it a connection held through a sleep/wake cycle would always fail, though not always with corruption).

My typical methodology fo devices where the device going into suspend/sleep while running is to alwasy close the database after every "transaction" with the database. Yes, this slows things down, but it greatly reduces both corruption and connection invalidation.

I've taken it to further extremes by watching for power manager events in the DAL and having it abandon and retry any data action it's working on during a power state change.

ctacke