1

im using sqlite database in my react native project i made app_db database that contain users table ,

and the path of database : /home/dina/AppointmentApp/android/app/src/main/assets/app_db

now i want to access to the users table in my project and execute some queries like select , update, insert ...etc

here is the code of open connection

  var db = SQLite.openDatabase({name : "app_db", createFromLocation : "~app_db"});


  db.transaction((tx)=>{

 tx.executeSql("select * from users",(tx,results) => {
  });

    }); 

i dont know if this query is correct or not it is return in console

-OPEN database: app_db -{message: "no such table: users (Sqlite code 1): , while comp…m users, (OS error - 2:No such file or directory)", code: 0}

1
  • I am in a somewhat problem that you can help me resolve, how did you create the database in the react native application folder ? @Dina Omari. I created a database but its get created at "/Library/Developer/CoreSimulator/Devices/0746958E-03AA-4A38-A208-2CD36B1A484E/data/Containers/Data/Application/7BE0AC9A-BD41-44DE-A2ED-31EA58CEB22E/Library/LocalDatabase/Reactoffline.db" Commented Sep 17, 2019 at 8:04

1 Answer 1

1

I know this is old, but as per the error code: your database does not have the table "users".

If you are certain that it does, then perhaps the path you point to is wrong, and the database is created automatically (without a users table).

See here for a similar problem: No Such Table error

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.