KJaeg
KJaeg

Reputation: 686

Inconsistency in SQLite-DB between Eclipse-project and SQLite Manager

I am developing a Java-application, which is using an SQLite-database. To have a better view of the data and to change the tables easier, I am using the Firefox plugin "SQLite Manager".

The sqlite-database is placed in my src-folder (src/db/db.sqlite). If I open the database from that location, the database shows old entries.

Instead, I have a method in my code, which is reading all data from the table, and writing it into a .docx. Here I can see the data, I previously wrote into the table in another method.

It looked like Eclipse was locking the database-file somehow. Copying it to another location, and reopen it from there with the SQLite-Manager, still showed old entries.

Edit: Now I added another column to my table and deleted the content of the table with the SQLite Manager. If I export the content of my table to a .docx again, I get en empty .docx, which tells me that the database now is consistent again with what is shown in the SQLite Manager.

I didn't manage to find an answer to that behaviour in the web. Does anyone know, why this happens?

Upvotes: 0

Views: 41

Answers (1)

OneCricketeer
OneCricketeer

Reputation: 191758

In Eclipse, your database is probably copied to the bin/ directory because you've included it under the src/ directory.

You should move your database file somewhere where you can load it from the resource loader instead of referencing the direct filepath on your disk.

Upvotes: 1

Related Questions