【发布时间】:2014-12-24 12:17:50
【问题描述】:
我正在使用 Perl,并且可以使用以下方式连接到本地 PostgreSQL 9.3 服务器 这段代码
#!/usr/bin/perl
use DBI;
use strict;
my $dbh = DBI->connect("dbi:Pg:dbname=postgres;host=127.0.0.1;port=5432", "postgres", "postgres", { RaiseError => 1 }) or die $DBI::errstr;
$dbh->disconnect();
print "Done\n";
现在,按照Catalyst documentation about PostgreSQL,我尝试生成一个 Catalyst 模型。
我使用这个 shell 命令
script/myapp_create.pl model DB DBIC::Schema MyApp::Schema \
create=static components=TimeStamp,EncodedColumn \
'dbi:Pg:dbname=postgres,host=127.0.0.1,port=5432' 'postgres' 'postgres' '{ AutoCommit => 1 }'
但我收到以下错误:
DBIx::Class::Storage::DBI::catch {...} ():
DBI Connection failed:
DBI connect('dbname=postgres,host=127.0.0.1,port=5432','postgres',...) failed:
FATAL: database "postgres,host=127.0.0.1,port=5432" does not exist at
/usr/local/share/perl/5.18.2/DBIx/Class/Storage/DBI.pm line 1487. at
/usr/local/share/perl/5.18.2/Catalyst/Helper/Model/DBIC/Schema.pm line 637
【问题讨论】:
标签: perl dbi catalyst postgresql-9.3