- Home /
Clearing cached sqlite
I have an sqlite database file in the StreamingAssets folder. I modified the file but when I run the game, Unity still displays value from the old copy. Is there any cache I need to clear?
SqliteDatabase sqlDB = new SqliteDatabase("gamedb.sqlite");
string query = "select * from enemy where name='"+enemyName+"'";
DataTable dt=sqlDB.ExecuteQuery(query);
int health=Int32.Parse(dt.Rows[0]["health"].ToString()); //get the value from the 'health' column of the first row
Did you integrate sqlite support yourself, or are you using a third party plugin?
Since ( I believe ) sqlite integration is not included in Unity3D, you would have to check and create the db instance yourself in your persistent path. Are you sure the logic there is correct and you're just not creating a copy of it every single time the game launches?
The only thing I did was to use the code above (I edited the question) which i got from one of the answers http://answers.unity3d.com/questions/53367/using-sqlite-for-iphone-build.html Basically, I am using a 3rd party plugin https://github.com/Busta117/SQLiteUnity$$anonymous$$it/
Answer by busta-gara · Jul 17, 2013 at 02:40 PM
hi, this plugin copy your local database to a folder in the system where you can modify, unity call this folder "persistentDataPath"
you need erase the database file from this folder, if you don't have idea where is this folder you can print in the log on unity tihs location: Application.persistentDataPath
Debug.Log("persistent data path: " + Application.persistentDataPath);
in this path you can see a copy of your old data base, remove that and after run your code again, you can see the code read a new data base
Your answer
![](https://koobas.hobune.stream/wayback/20220613102132im_/https://answers.unity.com/themes/thub/images/avi.jpg)