#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Posts
    1
    Rep Power
    0

    Web SQL - New database created every time, Database deleted on window close.


    I am trying to learn web sql and have come across probably 20 tutorials and have read through the official specification but somehow I am still confused.

    var db = openDatabase('mydb', '1.0', 'My Database', 2*1024*1024);

    Creates the database. I can see this in Safari by opening the web inspector > resources > databases.

    My problems are that every time I revisit the page it creates a new database even if one with the same name and version already exist. So if I hit enter on the address bar 10 times I will have 10 instances of mydb. Isn't it supposed to open the existing db? The second problem is that if you close the browser and reopen all 10 databases will be gone. Am I wrong in thinking that this data is supposed to persist beyond opening and closing of the browser?

    I've tried opening the db with its version number blank. I've tried running the page from localhost instead of the file system. Again, I've read about 20 tutorials and am a little disappointed that none of them seem to cover this.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Location
    London
    Posts
    40
    Rep Power
    15
    Have you tried this in other browsers? Have you tried this on other PC's? Other OS's?

    Do not assume that if something works/fails on one machine, that is going to the be the same behaviour in other set-ups.

    At least its always worth ruling it out, least you run into the old

    "But it worked on my computer"

IMN logo majestic logo threadwatch logo seochat tools logo