Check out example codes for "sqlite3 attempt to write a readonly database". It will help you in understanding the concepts better.

Code Example 1

//do the follow
chown www-data /myproject
chown www-data /myproject/db.sqlite3
chmod 777 /myproject/db.sqlite3

Learn ReactJs, React Native from akashmittal.com