javascript SQLITE_BUSY:数据库已锁定,sql:插入“用户"目录中 [英] javascript SQLITE_BUSY: database is locked, sql: insert into "users"

查看:76
本文介绍了javascript SQLITE_BUSY:数据库已锁定,sql:插入“用户"目录中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用注册"页面,但在使用sqlite时遇到问题.

I am working on a 'sign up' page and having trouble with sqlite.

我正在将express,bcrypt-nodejs,bookself.js用于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');
});

推荐答案

问题是在以编程方式与SQLite交互时,其他编辑器或SQLite客户端打开了".sqlite"文件.

The problem was that you have the ".sqlite" file opened by other editors or SQLite Clients while interacting with SQLite programmatically.

在运行/测试代码之前,请确保没有其他任何应用程序打开/使用.sqlite文件.

Make sure the .sqlite file is not opened/used by any other application before running/testing your code.

这篇关于javascript SQLITE_BUSY:数据库已锁定,sql:插入“用户"目录中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆