title: IndexedDB "The operation failed because the requested database object could not be found. "
body: <p>I'm creating a script to read an attribute from a database - due to the architecture of the project it's easiest if this is implemented in JS.</p>
  
  <p>I'm using IndexedDB, and I can find the database successfully, but when I try to get an attribute from the objectStore I'm getting an error (It seems I'm not able to access the Table):</p>
  
  <p><strong>Firefox:</strong> "NotFoundError: The operation failed because the requested database object could not be found. For example, an object store did not exist but was being opened."</p>
  
  <p><strong>Chrome:</strong> NotFoundError: Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found.</p>
  
  <p>My code:</p>
  
  <pre><code>var request = window.indexedDB.open("/app_name/database.sqlite", 1);
  request.onsuccess = function(event) {
      console.log("Found Database");
      db = event.target.result;
  
      var transaction = db.transaction(["TABLE"], "readonly");
      var objectStore = transaction.objectStore("TABLE");
      var ob = objectStore.get(String(ATTRIBUTE));
  
      ob.onsuccess = function(e) {
          console.log("Got ATTRIBUTE")
      }
      ob.onerror = function(e) {
          console.log("Have not got ATTRIBUTE")
      }
  
  }
  request.onerror = function(event) {
      console.log("Database not found");
  }
  </code></pre>
  
  <p>The error occurs on the line <code>var transaction = db.transaction(["TABLE"], "readonly");</code>.</p>
  
  <p>The TABLE does exist - when the database is opened in a viewer the attribute is there.</p>
  
  <p>I have not used <code>.onupgradeneeded</code> since I am not creating any new objectstores - rather just trying to read one.</p>