张淼 ha scritto:
#My Catalyst APP name is "NIC", #NIC/lib/NIC/Model/NiscDB.pmpackage NIC::Model::NiscDB; use strict; use base 'Catalyst::Model::DBIC::Schema '; __PACKAGE__->config( schema_class => 'NiscDB', connect_info => [ 'dbi:Pg:dbname=niscdb;host=210.42.1**.***', 'user', 'password', ], ); #NIC/lib/NiscDB.pm package NiscDB; use base qw/DBIx::Class::Schema/; __PACKAGE__->load_classes({ NiscDB => [qw/UserInfo/] }); #NIC/lib/NiscDB/UserInfo.pm package NiscDB::UserInfo; use base qw/DBIx::Class/; __PACKAGE__->load_components(qw/PK::Auto Core/); __PACKAGE__->table('userinfo');__PACKAGE__->add_columns(qw/serial_no dept_no user_no user_name user_addr ip_addr mac_addr link_switch node_no phone email memo/);__PACKAGE__->set_primary_key(qw/serial_no/); #And in my Controller Macs,the function is below sub find : Local { my ( $self, $c, $mac ) = @_; $c->res->redirect( $c->uri_for('/') ) unless ( $mac ); (my $user) = $c->model('NiscDB::UserInfo')->search({mac_addr => $mac}); $c->stash->{user} = $user; $c->stash->{template} = 'macs/find.tt2'; }#But When I locate http://catalyst/nic/macs/find/00:19:21:4b:05:24 <http://catalyst/nic/macs/find/00:19:21:4b:05:24>, There is an error:|Caught exception in NIC::Controller::Macs->find "DBIx::Class::ResultSet::search(): DBI Connection failed: could not connect to server: Permission denied Is the server running on host " 210.42.1**.***" and accepting TCP/IP connections on port 5432?" ||#How can I deal with it? Thanks!| ------------------------------------------------------------------------ _______________________________________________ List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class Wiki: http://dbix-class.shadowcatsystems.co.uk/ IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/ Searchable Archive: http://www.mail-archive.com/[email protected]/
This doesn't seem a dbix-class issue, but a much simpler connection problem to the databse server.
Have you checked that postgres is running on the server you are trying to connect to ?
Have you checked that the IP address (or dns name) you have specified in the catalyst application have not been misspelled ?
Also, try to connect to the postgres server using the command line client (psql) on the machine where the catalst application should be running.
HTH -- Marcello Romani Responsabile IT Ottotecnica s.r.l. http://www.ottotecnica.com _______________________________________________ List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class Wiki: http://dbix-class.shadowcatsystems.co.uk/ IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/ Searchable Archive: http://www.mail-archive.com/[email protected]/
