O'Reilly logo

Mastering PhoneGap Mobile Application Development by Kerri Shotts

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating and opening databases

Creating and opening databases using Web SQL Database or the Cordova SQLite Storage plugin is easy, but there are a few differences between the two that you do need to be aware of. Before we cover these differences, let's go over the basics.

Note

The snippets in this section are located at snippets/08/ex1-create-database/ in the code package of this book. When using the interactive snippet playground, select 8: Web SQL Database and Example 1.

While using Web SQL Database, you can open a database with the following:

let db = window.openDatabase(name, version, description, quota);

Let's go over the parameters:

  • name: This is the filename of the database. It usually ends in a .db extension. This parameter is required.
  • version ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required