LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-22-2011, 03:52 AM   #1
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 431
Blog Entries: 32

Rep: Reputation: 3
perl connect to sqlite


Hi I am trying to connect to sqlite via perl:
Code:
#! /usr/bin/perl

use LWP::Simple;
use XML::DOM;
use DBI;

...
33my $db = DBI->connect("dbi:SQLite:dbname=/var/db/blog1.db");
34
35$read = $db->prepare("SELECT * FROM blog");
36
37$read->execute($hash->{title});
38my $rows_ref = $sth->fetchall_arrayref;
39print $rows_ref
40
41$db->disconnect;
error:
Code:
DBD::SQLite::db prepare failed: file is encrypted or is not a database(26) at dbdimp.c line 271 at /mnt/sda1/test.sh line 35.
Can't call method "execute" on an undefined value at /mnt/sda1/test.sh line 37.
Thanks,
Ted
 
Old 04-22-2011, 04:25 AM   #2
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 431

Original Poster
Blog Entries: 32

Rep: Reputation: 3
Sorry, the problem is with the db:
Code:
my $db = DBI->connect("DBI:SQLite2:dbname=/var/db/blog1.db");
Cause I am using sqlite 2.
Thanks,
Ted
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Sqlite-Commander - A ncurses based tool to display the records and tables of a sqlite database LXer Syndicated Linux News 0 01-02-2011 08:11 AM
Apache, Perl, and SQLite - so close! glibdud Linux - Server 6 08-11-2010 08:16 AM
perl | DBI->connect | RHEL AS 3 kaN5300 Linux - Enterprise 6 09-14-2004 08:15 AM
Connect to SQLite with Tora & ODBC kkempter Linux - Software 2 07-22-2004 03:00 PM
Perl Sqlite DBI $sth->rows The Jesus Programming 0 10-21-2003 11:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration