An error occurred while reading the database from Android.

Source: Internet
Author: User

Test an Android program that reads an sqlite database mydb. After I perform the following operations, the getWritableDatabase method of SQLiteOpenHelper has an exception.
1. backed up this database in adb shell: mv mydb mydb_bak
2. Restore the database again: mv mydb_bak mydb
3. Run the program and the above error occurs.

Use a program to generate an available database. The following differences exist between the available database and the database backed up:
Ls-l

Available databases:
-Rw ---- app_48 app_48 37888 mydb

Databases backed up:
-Rw ---- root 37888 2010-11-20 20:34 mydb

The problem is clear at a glance. The permission has not changed, and the group to which the permission belongs has changed. The program does not have the root permission. Of course, mydb that has been backed up cannot be opened.
Modify file permission: chown app_48.app_48 mydb
Solve the problem.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.