react-native-sqlite
react-native-sqlite copied to clipboard
Can't open database
So I created an .sql and .sqlite file through the Terminal.
I created the same table and inserted one row. To see if I could read from it.
I placed the files in the same place as in the react-native-sqlite-example and both of them don't work.
The error message while selecting all rows (select * from table;) basically returns the error message:
No such table: teste (teste is my table btw)
So I see someone here got a similar error. No file is created either. I would love to have this working.
Did you add the file to the project and make sure that it's being copied to your app in development?
I added the file to the project and I didnt quite understand what you meant by "make sure that it's being copied to your app in development".
All I did is put the file in the folder like the example. Since no more instructions were given I thought that was it. Is there something more I should do?
You shouldn't need to create the files via the terminal. The .sqllite file gets auto-created in the app documents directory if it doesn't exist already. And you can run the sql commands via javascript (to create a table, insert data, etc). It should work. It does for me.
No files are created for me. What is the relative path to the documents folder?
You should create a folder in your XCode named Documents and put the sqlite file there. Also verify that the sqlite file is included in the list named Copy Bundle Resources in Build Phases of your project. This worked well form me
@ermannos Can you explain how to do clearly? I have a problem with database like this. But i've tried to do like you said. But it's not work. Thank you.
Please don't use this library! It's been surpassed by other more recent libraries such as https://github.com/andpor/react-native-sqlite-storage