简体   繁体   English

Perl 和 Sqlite

[英]Perl And Sqlite

Can someone tell me how to access a sqlite3 database from perl.谁能告诉我如何从 perl 访问 sqlite3 数据库。

the code编码

use DBI;
use DBD::SQLite;

my $dbh = DBI->connect(
  "dbi:SQLite:dbname=/cbilldata/media/database/collector.db","",""
) or die "Cannot connect: $DBI::errstr";

returns error返回错误

DBI connect('dbname=/cbilldata/media/database/collector.db','',...) failed: database disk image is malformed at./db.pl line 7 DBI connect('dbname=/cbilldata/media/database/collector.db','',...) 失败:数据库磁盘映像在./db.pl 第 7 行格式错误
Cannot connect: database disk image is malformed at./db.pl line 7.无法连接:数据库磁盘映像在./db.pl 第 7 行格式错误。

Either your version of DBD::SQLite is a very old one that uses SQLite 2 and not 3, or the message is accurate and your database is corrupt.您的 DBD::SQLite 版本是一个非常旧的版本,使用 SQLite 2 而不是 3,或者消息是准确的并且您的数据库已损坏。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM