为什么不能DBD :: SQLite的通过我的Perl CGI脚本插入到数据库? [英] Why can't DBD::SQLite insert into a database through my Perl CGI script?

查看:305
本文介绍了为什么不能DBD :: SQLite的通过我的Perl CGI脚本插入到数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行正在由 DBD :: SQLite的访问一个Perl CGI脚本中的SQLite数据库。这是正在运行的Apache的直CGI。

的DBI连接工作正常,并选择能够运行。然而,当我试图做一个插入我得到以下错误的模具:

  DBD :: SQLite的:: ST执行所失败:不能(1)dbdimp.c线402来打开数据库文件,同时将index.cgi脚本行66

我试图改变数据库文件的权限为666,试图解决这个问题,但是我现在仍然收到错误。

任何意见?


解决方案

它看起来像目录需要写权限,其原因是:


  

SQLite的需要能够创建在同一目录作为数据库日志文件,在此之前的任何修改才能进行。该杂志用于支持事务回滚。


来源:似乎需要对数据库的父目录

I am running a SQLite database within a Perl CGI script which is being accessed by DBD::SQLite. This is being run as a straight CGI on Apache.

The DBI connection works fine and selects are able to be run. However, when I attempt to do an insert I get a die with the following error:

DBD::SQLite::st execute failed: unable to open database file(1) at dbdimp.c line 402 at index.cgi line 66

I have tried changing the database file permission to 666 to try to fix this however I am still receiving the error.

Any advice?

解决方案

It looks like the directory needs write permission, the reason is:

SQLite needs to be able to create a journal file in the same directory as the DB, before any modifications can take place. The journal is used to support transaction rollback.

From: seem to need write permission on db's parent directory

这篇关于为什么不能DBD :: SQLite的通过我的Perl CGI脚本插入到数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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