I am working on a 'sign up' page and having trouble with sqlite.
I am using express, bcrypt-nodejs, bookself.js for sqlite. getting an error saying database is lock. any workaround for this? appreciated. below is the code for the part.
app.post('/signup', function(req, res){
var username = req.body.username;
var password = req.body.password;
bcrypt.hash(password, null, null, function(err, hash){
new User({'username': username, 'password': hash})
.save()
.then(function(){
console.log('Successfully added a user');
})
.catch(function(err){
throw err;
});
});
res.render('login');
});
I am working on a 'sign up' page and having trouble with sqlite.
I am using express, bcrypt-nodejs, bookself.js for sqlite. getting an error saying database is lock. any workaround for this? appreciated. below is the code for the part.
app.post('/signup', function(req, res){
var username = req.body.username;
var password = req.body.password;
bcrypt.hash(password, null, null, function(err, hash){
new User({'username': username, 'password': hash})
.save()
.then(function(){
console.log('Successfully added a user');
})
.catch(function(err){
throw err;
});
});
res.render('login');
});
Share
Improve this question
edited Nov 3, 2015 at 16:32
jhlosin
asked Nov 3, 2015 at 8:18
jhlosinjhlosin
5752 gold badges7 silver badges17 bronze badges
2 Answers
Reset to default 14The problem was that you have the ".sqlite" file opened by other editors or SQLite Clients while interacting with SQLite programmatically.
Make sure the .sqlite file is not opened/used by any other application before running/testing your code.
Also works, when you kill the running port.
For ubuntu Use:
'sudo kill -9 `sudo lsof -t -i:<POOR_NUMBER>`'