Inxdb Uncaught TypeError: Cannot read property 'transaction' of undefined

Uncaught TypeError: Cannot read property ‘transaction’ of undefined line 93

I am getting on below trying list entries on load/refresh of jQuery mobile page

var transaction = databaseObj.[B]transaction/B; // line 93 - transaction undefined

var idb ='myIDBVideoHistory', 1);
var databaseObj;

idb.onupgradeneeded = function(event){'entries',{keyPath:'entrydate'});


idb.onsuccess = function(event){
	databaseObj =;

$(document).ready(function(e) {

function showAllEntriesInit(){
var t=0;
var h = $('history-played');
h.html = '';
var transaction = databaseObj.transaction("entries", "readonly");   // line 93
var store = transaction.objectStore("entries");
var request = store.openCursor(IDBKeyRange.lowerBound(0), 'prevunique');
request.onsuccess = function(event) {
  var cursor =;

I am a reader of sitepoint book Html5 offline apis…indexedDB chapter…
If i want apply data result from indexedDB to list view jQ mobile and apply onclick event in each with a data attr as param to onclick function… you have any sample code?

function buildListItem(entry){
	var o,
		li = document.createElement('li'),
		a = document.createElement('a'),
		h = document.getElementById('history-played');

	a.setAttribute("class","ui-btn ui-btn-icon-right ui-icon-carat-r");
	a.setAttribute("data-link-url-v", entry.url ); 
	a.innerHTML = new Date(+entry.entrydate).toDateString() + " " + entry.url;