FAQ
Hi,

I am very new to Catalyst and have found it pretty exciting so far. I have a
very basic "People" database table and whenever I try to run the following
script:


#!/usr/bin/perl

use strict;
use warnings;

use lib qw( lib ../lib );


use Markets::Schema::MarketDB;
use Markets::Model::MarketDB;

# demonstrate picking up database connection info
my $connect_info = Markets::Model::MarketDB->config->{connect_info};
print "connecting schema to ".$connect_info->[0]."\n";

# connect to the Catalyst schema
my $schema = Markets::Schema::MarketDB->connect( @$connect_info );


# list all People
print "listing all People\n";
my $rs = $schema->resultset('People')->search({});
for my $row ( $rs->all ){
print "\nPerson ". $row->id ."\t - Name " . $row->first_name . "\n";
}

1;

from .../markets/script/test.pl I get the following error:

connecting schema to dbi:SQLite:database
listing all People
DBIx::Class::ResultSet::all(): DBI Exception: DBD::SQLite::db prepare_cached
failed: no such table: people(1) at dbdimp.c line 271 [for Statement "SELECT
me.id, me.first_name, me.last_name FROM people me"] at test.pl line 26

It seems I am successfully connecting but failing to read from my database?
Any ideas what I may be doing wrong? Please help!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20081010/95f0791f/attachment.htm

Search Discussions

  • Jay Shirley at Oct 10, 2008 at 5:48 am

    On Thu, Oct 9, 2008 at 9:00 PM, Proud Dzambukira wrote:
    Hi,

    I am very new to Catalyst and have found it pretty exciting so far. I have a
    very basic "People" database table and whenever I try to run the following
    script:


    #!/usr/bin/perl

    use strict;
    use warnings;

    use lib qw( lib ../lib );


    use Markets::Schema::MarketDB;
    use Markets::Model::MarketDB;

    # demonstrate picking up database connection info
    my $connect_info = Markets::Model::MarketDB->config->{connect_info};
    print "connecting schema to ".$connect_info->[0]."\n";

    # connect to the Catalyst schema
    my $schema = Markets::Schema::MarketDB->connect( @$connect_info );


    # list all People
    print "listing all People\n";
    my $rs = $schema->resultset('People')->search({});
    for my $row ( $rs->all ){
    print "\nPerson ". $row->id ."\t - Name " . $row->first_name . "\n";
    }

    1;

    from .../markets/script/test.pl I get the following error:

    connecting schema to dbi:SQLite:database
    listing all People
    DBIx::Class::ResultSet::all(): DBI Exception: DBD::SQLite::db prepare_cached
    failed: no such table: people(1) at dbdimp.c line 271 [for Statement "SELECT
    me.id, me.first_name, me.last_name FROM people me"] at test.pl line 26

    It seems I am successfully connecting but failing to read from my database?
    Any ideas what I may be doing wrong? Please help!

    A couple things wrong:

    1) This is a DBIx::Class problem, of which there is a separate list.
    This is for Catalyst, the MVC framework. You can subscribe to that
    list at http://lists.scsys.co.uk/mailman/listinfo/dbix-class/

    2) You haven't deployed your database. The table doesn't exist. When
    you get an error that says "no such table: people" the problem is
    quite clearly defined. There is no such table.
    You can read about deploying here:
    http://search.cpan.org/~ash/DBIx-Class-0.08010/lib/DBIx/Class/Schema.pm#deploy

    Thanks,
    -J

    --
    J. Shirley :: [email protected] :: Killing two stones with one bird...
    http://www.coldhardcode.com

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedOct 10, '08 at 5:00a
activeOct 10, '08 at 5:48a
posts2
users2
websitecatalystframework.org
irc#catalyst

2 users in discussion

Proud Dzambukira: 1 post Jay Shirley: 1 post

People

Translate

site design / logo © 2023 Grokbase