Weird Behavior!!!
Hi list,
Me and Perl again... =o)
I have two versions of Pg in my machine!!!! 7.2.3 & 7.3.1
I have the perl code to connect to Pg, however I'm only able to connect
to Pg 7.2.3, the error message in Pg 7.3.1 is :
Pg 7.2.3: perl pg_connect.pl
[pgsql@ibizs04 examples]$ perl pg_connect.pl
Connected!!!
97422620003680 bompreco Lj. Cabula bompreco Lj. Cabula
97422620003761 bompreco Lj. FINAL 03761 bompreco Lj. FINAL 03761
Disconnected!!!
Pg 7.3.1: perl pg_connect.pl
[pgsql@ibizs04 examples]$ perl pg_connect.pl
FATAL: No pg_hba.conf entry for host 164.35.10.17, user pgsql, database
corban DBI
connect('dbname=corban;host=164.35.10.17;port=5432','pgsql',...) failed:
FATAL: No pg_hba.conf entry for host 164.35.10.17, user pgsql, database
corban at pg_connect.pl line 16
Perl Package version:
=====================
[pgsql@ibizs04]$ perl -e 'use DBI; use DBD::Pg; print "DBI:
$DBI::VERSION, DBD::Pg $DBD::Pg::VERSION\n";'
DBI: 1.32, DBD::Pg 1.21
PG_CONNECT.PL
=============
#!/usr/bin/perl
use DBI;
use DBD::Pg;
use strict;
my $dbh;
my $dbname='corban';
my $host='164.35.10.17';
my $port='5432';
my $options='';
my $username='pgsql';
my $password='pgsql';
$dbh = DBI->connect("dbi:Pg:dbname=$dbname;host=$host;port=$port",
"$username",
"$password",
{ RaiseError => 1, AutoCommit => 0 }) || die
$DBI::errstr;
print "Connected!!!\n";
my $hSt = $dbh->prepare('SELECT * FROM table Limit 2;');
$hSt->execute;
while(my @raD = $hSt->fetchrow_array()){ print
"$raD[0]\t$raD[1]\t$raD[2]\n";}
$hSt->finish;
$dbh->disconnect;
print "Disconnected!!!\n";
[pgsql@corban:5432]#select version();
-[ RECORD 1 ]--------------------------------------------------------
version | PostgreSQL 7.3.1 on i586-pc-linux-gnu, compiled by GCC 2.96
[pgsql@ibizs04 examples]$ /usr/local/postgresql-7.3.1/bin/psql -l
List of databases
Name | Owner | Encoding
-----------+-------+-----------
corban | pgsql | SQL_ASCII
db | pgsql | LATIN1
template0 | pgsql | SQL_ASCII
template1 | pgsql | SQL_ASCII
(4 rows)
pg_hba.conf
===========
# TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
local all all md5
host all all 164.35.10.0 255.255.255.0 md5
[pgsql@corban:5433]#select version();
-[ RECORD 1 ]--------------------------------------------------------
version | PostgreSQL 7.2.3 on i586-pc-linux-gnu, compiled by GCC 2.96
[pgsql@ibizs04 examples]$ psql -l
List of databases
Name | Owner
-----------+-------
corban | pgsql
db | pgsql
template0 | pgsql
template1 | pgsql
(4 rows)
pg_hba.conf
===========
# TYPE DATABASE IP_ADDRESS MASK AUTH_TYPE
# AUTH_ARGUMENT
#
local all crypt
host all 164.35.10.0 255.255.255.0 crypt
-----------------------------
Renê Salomão
Ibiz Tecnologia -- www.ibiz.com.br
(011) 5579-3178 - R. 211
Ren� Salom�o wrote:
Hi list,
Hi,
I am not sure I understand what you ask exactly.
It looks like you don't know why you cannot connect to 7.3
Please check:
- you stopped the postmaster for 7.3 before starting 7.2 and vise versa.
- Right now it looks like you try to connect via TCP/IP which you should
enable when you start postgres. Are you sure you editted postgresql.conf
in your 7.3 datadirectory? (propably in /usr/local/pgsq/data)
It should look something like this:
#
# Connection Parameters
#
tcpip_socket = true
#ssl = false
#max_connections = 32
#superuser_reserved_connections = 2
port = 5432
#hostname_lookup = false
#show_source_port = false
Another thing:
- Let everybody connect in your pg_hba.conf to test if your script works
anyway.
Now you have two different lines.
host all 164.35.10.0 255.255.255.0 crypt
host all all 164.35.10.0 255.255.255.0 md5
Good luck,
Regards,
Erwin
PS: One more thing: I have the same double install as you do and putted
my new postgresql-bin at the beginning of the path because I want these
(custom) scripts to execute and not the ones in /usr/bin that were
placed there by 7.2
Show quoted text
Me and Perl again... =3Do)
I have two versions of Pg in my machine!!!! 7.2.3 & 7.3.1
I have the perl code to connect to Pg, however I'm only able to connect
to Pg 7.2.3, the error message in Pg 7.3.1 is :Pg 7.2.3: perl pg_connect.pl
[pgsql@ibizs04 examples]$ perl pg_connect.pl=20
Connected!!!
97422620003680 bompreco Lj. Cabula bompreco Lj. Cabula
97422620003761 bompreco Lj. FINAL 03761 bompreco Lj. FINAL 03761
Disconnected!!!Pg 7.3.1: perl pg_connect.pl
[pgsql@ibizs04 examples]$ perl pg_connect.pl=20
FATAL: No pg_hba.conf entry for host 164.35.10.17, user pgsql, database
corban DBI
connect('dbname=3Dcorban;host=3D164.35.10.17;port=3D5432','pgsql',...) fail=
ed:
FATAL: No pg_hba.conf entry for host 164.35.10.17, user pgsql, database
corban at pg_connect.pl line 16Perl Package version:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
[pgsql@ibizs04]$ perl -e 'use DBI; use DBD::Pg; print "DBI:
$DBI::VERSION, DBD::Pg $DBD::Pg::VERSION\n";'=20DBI: 1.32, DBD::Pg 1.21
PG_CONNECT.PL
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
#!/usr/bin/perluse DBI;
use DBD::Pg;
use strict;my $dbh;
my $dbname=3D'corban';
my $host=3D'164.35.10.17';
my $port=3D'5432';
my $options=3D'';
my $username=3D'pgsql';
my $password=3D'pgsql';$dbh =3D DBI->connect("dbi:Pg:dbname=3D$dbname;host=3D$host;port=3D$port",
"$username",=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
"$password",=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20
{ RaiseError =3D> 1, AutoCommit =3D> 0 }) || die
$DBI::errstr;print "Connected!!!\n";
my $hSt =3D $dbh->prepare('SELECT * FROM table Limit 2;');
$hSt->execute;
while(my @raD =3D $hSt->fetchrow_array()){ print
"$raD[0]\t$raD[1]\t$raD[2]\n";}$hSt->finish;
$dbh->disconnect;
print "Disconnected!!!\n";
[pgsql@corban:5432]#select version();
-[ RECORD 1 ]--------------------------------------------------------
version | PostgreSQL 7.3.1 on i586-pc-linux-gnu, compiled by GCC 2.96[pgsql@ibizs04 examples]$ /usr/local/postgresql-7.3.1/bin/psql -l
List of databases
Name | Owner | Encoding=20=20
-----------+-------+-----------
corban | pgsql | SQL_ASCII
db | pgsql | LATIN1
template0 | pgsql | SQL_ASCII
template1 | pgsql | SQL_ASCII
(4 rows)pg_hba.conf
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
# TYPE DATABASE USER IP-ADDRESS IP-MASK METHODlocal all all md5
host all all 164.35.10.0 255.255.255.0 md5[pgsql@corban:5433]#select version();
-[ RECORD 1 ]--------------------------------------------------------
version | PostgreSQL 7.2.3 on i586-pc-linux-gnu, compiled by GCC 2.96[pgsql@ibizs04 examples]$ psql -l
List of databases
Name | Owner=20
-----------+-------
corban | pgsql
db | pgsql
template0 | pgsql
template1 | pgsql
(4 rows)pg_hba.conf
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
# TYPE DATABASE IP_ADDRESS MASK AUTH_TYPE=20
# AUTH_ARGUMENT
#=20
local all crypt=20
host all 164.35.10.0 255.255.255.0 crypt-----------------------------=20
Ren=EA Salom=E3o
Ibiz Tecnologia -- www.ibiz.com.br
(011) 5579-3178 - R. 211---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)