From: Sean Murphy <>
Date: 平成23年12月9日 20:42:49:JST
Subject: DBI under the MAC

Hi All.

I am having some strange behaviours. I have created a simple script to insert data into a SQLite database. When I use the prepare are
statement. The DBI driver complains that there is no such table.

The code looks like thus:


# Combining credit and savings sheets
# to find expenses and income.

use strict;
                                                          use DBI;

my $db_driver = "SQLite";
my $db_file = "budget.db";
my $dns = "DBI:$db_driver:database=$db_file";

my $dbh = DBI->connect ($dns, '', '',
            { RaiseError => 1, AutoCommit => 0});

my $sth1 = $dbh->prepare("insert into cat (name) values (?);")
         or die("Cannot prepare table: " . DBI::errstr() );

my $sth2 = $dbh->prepare("insert into trans (accounts, transaction_date, description, amount, amount_type, transaction_type, serial, category_id) values (?, ?, ?, ?, ?, ?, ?, ?);")
                  or die("Cannot prepare: " . DBI::errstr() );

When the above is executed in the full script. We get the following error:

DBD::SQLite::db prepare failed: table trans has no column named accounts at ./ line 60. Cannot prepare: table trans has no column named accounts at ./ line 60.

The Schema for the table shows trans being present. As follows:

sqlite> .schema trans
CREATE TABLE trans (transaction_id int primary key, account int, transaction_date date, description varchar(80), amount decimal (11,2), amount_type varchar(3) not null, transaction_type varchar (40), serial varchar(40), category_id int);

Any ideas what might be going on here? The drivers are being found. I have tested this by using the perl -d option with the script.


From the content of your question, I'm guessing that you're working with Mac OS X and therefore non-MacPerl perl.

This list is for MacPerl, which is perl on the old pre-Mac OS X Mac systems.

The list you probably want is at .

I really shouldn't forward this to that list, but I will.

As far as your question is concerned, I'm not familiar with SQLite, but it looks to me like your problem is not Mac OS X related. You might want to check your table definition again.

Joel Rees
(waiting for a 3+GHz ARM processor to come out,
to test Tim's willingness to switch again.)

Reply via email to