Thursday, November 3, 2011

Indexed DB: Deleting your database

In a previous post I have been talking about creating and deleting a database. The creation/opening of a database is supported in all the major browsers, but deleting isn’t. Only Internet Explorer currently supports deleting your database trough the IDBFactory interface.

Because we have been playing for a while now, it’s interesting we can delete our database so we can rebuild it from scratch without having to use a new name for our database. I’m only used to work on windows machines, so the solution I will propose will probably only work under windows. If you are using an other operating system, it will work on the same way, but you’ll have to look where you can find the databases.

Firefox

The Indexed DB databases of Firefox can be found on the following location:

<location of the windows user profiles>\<account name>\AppData\Roaming\
Mozilla\Firefox\Profiles\<some random characters>.default\IndexedDB

In my case this is:

C:\Users\kristof\AppData\Roaming\Mozilla\Firefox\Profiles\ tvv6t475.default\indexedDB

You will find a folder with your current domain. Delete these folder, and you can start all over again. In my case, I get the following:

http+++localhost+50350

I have to notice that the AppData folder is a hidden folder, so it is possible you won’t see it when going to your user profile directory.

Chrome

The Indexed DB databases of Chrome can be found on the following location:

<location of the windows user profiles>\<account name>\AppData\Local\Google\
Chrome\User Data\Default\IndexedDB

In my case this is:

C:\Users\kristof\AppData\Local\Google\Chrome\User Data\Default\IndexedDB

You will find a folder and a file with your current domain. Delete these files, and you can start all over again.

In my case I get the following:

folder: http_localhost_50350.indexeddb.leveldb
file:     http_localhost_50350.indexeddb

11 comments:

  1. An alternative for deleting the database (until it's not implemented), would be to delete each objectStore listed in db.objectStoreNames.

    ReplyDelete
  2. Delete db in Ubuntu:
    Chromium:
    /home/yourname/.config/chromium/Default/IndexedDB
    Firefox:
    /home/yourname/.mozilla/firefox/xxxxxx.default/indexedDB

    ReplyDelete
  3. Tnx for the extra information for Linux users.

    @Matthew: That is a possibility, but your database still exists in that case. Sometimes it's usefull to have you're database delete. For example i made al little framework to make it easy to handle structure changes in your database depending on the version. So if I want to start all over again, it's nice to have a fresh start :).

    ReplyDelete
  4. Hey guys, How bout deleting the DB on a mobile device? Building an app for the Samsung Galaxy Tab (firefox beta) and I need a fresh start.

    ReplyDelete
  5. @Jason Minnick

    I think you'll have to locate the appdata folder of firefox. An other shot is looking in the settings of the browser ...

    I don't have an android operating system, so this will be the best guesses i can make.

    ReplyDelete
  6. I am facing a problem with IndexedDB in Chrome.. When I clear a cache from a different domain, the Indexed gets deleted automatically. Any thought?

    ReplyDelete
  7. Please advise what code enables an IndexedDB to be stored in a certain directory/folder?

    The directory/folder could be:
    D:\AppData\MyFirstDatase

    Thank you

    ReplyDelete
  8. I think you'll need to find the app data organizer of firefox. An other shot is looking in the settings of the browser.I don't have an android working framework, so this will be the best suppositions i can make. PhD Dissertation Writing Services

    ReplyDelete
  9. A database transaction is defined as a unit of work carried out within a database management system, which is capable of being identified in a reliable and coherent way, while being independent of other transactions.kpi dashboards

    ReplyDelete
  10. I'm facing a trouble with IndexedDB in Chrome.. When I clear a cache from an alternative domain, the Indexed gets deleted automatically.

    dubai bookkeeping services

    ReplyDelete
  11. Whether you use a contractor or develop the database yourself, selecting the right software for your present and future needs is an important decision.oracle dashboards

    ReplyDelete