In this blog, I’m explaining  record insert and retrieve  using sqlite database in nodejs.

1.       DataBaseConnection.js file

var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database('databases/users');
db.serialize(function () {"CREATE TABLE NodeJs (Name TEXT,EmailID TEXT,City TEXT)");
    var stmt = db.prepare("INSERT INTO NodeJs VALUES (?,?,?)");"Kamlakar Singh","","Allahabad");
    db.each("SELECT rowid AS id, Name,EmailID,City FROM NodeJs", function (err, row) {
        console.log( + ": " + row.Name+" : "+row.EmailID+" : "+row.City);

    2. Open command prompt and go to your file location your project. 

3. Install sqlite3 like this.

       Npm install sqlite3.

4.       Execute your  file like this

5.       Record insert and retrieve successfully .

in my next post i'll explain about Javascript framework and library

  Modified On Sep-18-2014 01:24:21 PM

Leave Comment