Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8466289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:17:56+00:00 2026-06-10T15:17:56+00:00

I have problem with indexeddb – I’m using this method to open and setup

  • 0

I have problem with indexeddb – I’m using this method to open and setup db

DBService.prototype.open = function (dbName, entity, cb) {
  var self = this;
  var req = indexedDB.open(dbName)
  req.onsuccess = function(e) {
    var v = 1;
    DBService.storage.db = e.target.result;
    var db = DBService.storage.db;
    // We can only create Object stores in a setVersion transaction;
    if (v != db.version) {
      var setVrequest = db.setVersion(v);

      setVrequest.onerror = function (err, stack) {
        console.log(err, stack);
      }

      setVrequest.onsuccess = function(e) {
        if(db.objectStoreNames.contains(entity)) {
          db.deleteObjectStore(entity);
        }

        var store = db.createObjectStore(entity,
          {keyPath: "timeStamp"});
        e.target.transaction.oncomplete = function() {
          console.log(db);
          cb(db);
        };
      };
    } else {
      cb(db);
      /*
      req.transaction.oncomplete = function() {
        cb(db);
      */
    }
  };

  req.onerror = function (err, stack) {
    console.log(err)
    console.log(stack)
  }
};

Everything works nice except case when db is not ever opened. Im still getting

InvalidStateError: DOM IDBDatabase Exception 11

(when I console.log req.error)

I know this code is pretty dirty now, I’m trying everything. I promise that when it will works well, then I will refactor it!

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T15:17:58+00:00Added an answer on June 10, 2026 at 3:17 pm

    I’m assuming you are only using this page in chrome since the other browsers no longer support setVersion.

    What exactly do you mean “Everything works nice except case when db is not ever opened.”? Sometimes the db.open call fails and req.onerror is called? In any case your error event handler should only take one parameter, only an error is passed, not a stack.

    One common cause of the InvalidStateError: DOM IDBDatabase Exception 11 exception you’re getting is accessing req.error before the request object has received any events. For example, this code will throw Exception 11:

    var request = indexedDB.open("some db");
    console.log(request.error);
    

    whereas

    var request = indexedDB.open("some db");
    request.onerror = request.onsuccess = function(e) { console.log(request.error); };
    

    will not throw an exception.

    You might also want to add setVrequest.onblocked = function(e) { console.log("got blocked:" + e); }; just so that you know if blocked events could be causing you some trouble.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem with my query on C, I’m using the oci8 driver. This
I have almost solved this quadrant queries problem of Interviewstreet using segment trees with
I'm very confused with this wee little problem I have. I have a non-indexed
I have a problem with lucene indexation, I insert one indexed entity in a
I have a similar situation like this one @Entity @Indexed public class Place {
I have a simple setup and encountered a puzzling (at least for me) problem:
I have a problem where my query is Using filesort , even though the
I have a TYPO3 site with Indexed Search Engine extension... The problem is that
I have a product table where the description column is fulltext indexed. The problem
I have problem with http://abfoodpolicy.com/ . In IE 8 and 9 the right sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.