On 1/31/07, Sebastian Selau Webber Colombo <[EMAIL PROTECTED]> wrote:

pessoal, bom dia!

  Alguém alguma sugestão de como posso testar a conexão de qualquer
máquina com o servidor onde está o postgres?


Script em Perl:

#!/usr/bin/perl -w

use strict;
use warnings;

use DBI;

my $dbh = DBI->connect( "dbi:Pg:dbname=dbname;host=host", "username", "
password );
my $mean = {
   1 => 'Database is idle (not in a transaction)',
   2 => 'Database is active, there is a command in progress (usually seen
after a COPY command)',
   3 => 'Database is idle within a transaction',
   4 => 'Database is idle, within a failed transaction'
};
my $rc = $dbh->ping;

print $mean->{$rc}, "\n";

p.s.: precisa ter instalado os componentes DBI e DBD::Pg. No linux:
[EMAIL PROTECTED] ~]$ su
reis:~# cpan
CPAN: File::HomeDir loaded ok

cpan shell -- CPAN exploration and modules installation (v1.8802)
ReadLine support enabled


cpan[1]> install DBI DBD::Pg

--
wallace reis
Núcleo de Biologia Computacional e
Gestão de Informações Biotecnológicas/LABBI
_______________________________________________
Grupo de Usuários do PostgreSQL no Brasil
Antes de perguntar consulte o manual
http://pgdocptbr.sourceforge.net/

Para editar suas opções ou sair da lista acesse a página da lista em:
http://pgfoundry.org/mailman/listinfo/brasil-usuarios

Responder a