question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Release and/or Delete SQLite database

See original GitHub issue

Steps to reproduce

I have a sqlite database that I create locally. Whenever the app goes online and a user signs in an identical in structure, already populated sqlite database is retrieved from a server. I also have an “offline” database that stores local changes that eventually get synced to the cloud. My app uses the offline database as the main database and attaches the online database. The problem I am having is when I try to retrieve this online database and overwrite the existing online database. I have tried closing the connection, detaching the database and calling EnsureDeleted but every time I try to save the file data to the existing database file, I am notified that the file is already being used by another process. Which makes sense, because the SQLite file is being used.

The issue

I need a way to release the file from the process either by detaching the database and/or closing the connection or deleting the existing file. Database.CloseConnection(), Database.EnsureDeleted() does not appear to work. When I call Database.EnsureDeleted(), I also get the error so the attempts to detach and close the connection beforehand also did not work.

Further technical details

EF Core version: 1.0.1 Operating system: Windows 10 Visual Studio version: VS2015

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
rowanmillercommented, Nov 18, 2016

Thanks for the app to reproduce it. We’ll get someone assigned to debug it. We’ve had a bit of a wave of issues come in, so it may take a little bit to get to it.

1reaction
johnmurphy01commented, Nov 16, 2016

Sure I’ll put something together

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to delete SQLite database from Android ...
Once you have your Context and know the name of the database, use: context.deleteDatabase(DATABASE_NAME);. When this line gets run, ...
Read more >
How to Delete Data in SQLite Database in Android?
Navigate to the app > java > your app's package name > DBHandler and add the below code to it. Java. Java ...
Read more >
Insert, Read, Delete & Update Operation In SQLite
Insert, Read, Delete & Update Operation In SQLite. Android provides different ways to store data locally so using SQLite is one the way...
Read more >
Delete SQLite database when uninstall App - Ionic Forum
Hello,. when I uninstall my App, it seems like the SQLite Database wouldn't deleted . I uninstalled my App and installed it again...
Read more >
Delete data from SQLite database - Free Android Tutorials
Delete data from SQLite database ... First of all, we will write add a new method called deleteData() in DatabaseHelper class which will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found