O'Reilly logo

CoffeeScript Application Development Cookbook by Mike Hatfield

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

Working with SQLite

SQLite is a lightweight, schema-based relational database engine that executes within the memory context of our application. This proves to be very convenient when developing your application, as SQLite does not require a database server.

Getting started

We will be using the sqlite3 Node module. You can install this module using NPM as follows:

$ npm install sqlite3

Once installed, you can require it in your application using the following:

sqlite = require 'sqlite3'

Once required, you can create a connection to an existing database by filename:

db = new sqlite3.Database('sample.db')

If the database does not exist, an empty database will be created for you.

We will be using a sample database for our examples, which contains a simple ...

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