IndexedDB createObjectStore exeception RRS feed

  • Question

  • Hello

    When i call     var store = db.createObjectStore('Products', { keyPath: 'ProductKey', autoIncrement: false }); i got a exception "Indexed Database Exception: NOT_ALLOWED_ERR (6)". 

    What could be the problem? I am not using setVersion() .

    Are there any good examples for using IndexedDB ?



    Sunday, March 25, 2012 11:44 AM


All replies

  • Hi,

    If you can share more code snippets here, it's more useful for us to do further investigation.

    Please visit http://msdn.microsoft.com/en-us/library/hh673548(v=vs.85).aspx to learn more about IndexDB.

    Here is an example for your reference http://www.codeproject.com/Articles/325135/Getting-Started-with-IndexedDB

    Best wishes,

    Robin [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, March 26, 2012 9:09 AM
  • i think i found the problem, i was creating the objectstore inside the success handler, in place of the onupgradedneeded handler. Now it works.

    Monday, March 26, 2012 2:03 PM
  • hmm i was wrong, the problem is still there, where do i have to create my object store ? inside onsuccess or onupgradeneeded?
    Monday, March 26, 2012 3:44 PM
  • You should be able to create object stores inside of onupgradeneeded of your open request:

    var openReq = iDB.open("myDB", 1);
    openReq.onupgradeneeded = function (req) {
        var db = req.target.result;
        if (db.objectStoreNames.contains("myStore") === false) {

    Of course it only gets called if the version of your DB passed to open() is different from the last time you opened it.



    • Marked as answer by Jie Bao Monday, April 9, 2012 7:22 AM
    Monday, March 26, 2012 6:14 PM