[rt-users] Debian setup: postgres problem?
Jens Porup
jens at cyber.com.au
Tue Jun 29 22:59:59 EDT 2004
On Tue, Jun 29, 2004 at 09:41:01AM +0100, Stephen Quinney wrote:
> On Mon, Jun 28, 2004 at 12:07:49PM +1000, Jens Porup wrote:
>
> > But a simple Perl script connects to the database without dying, like so:
> >
> > use DBI;
> > my $dsn = "dbi:Pg:dbname=template1";
> >
> > ###
> > ### But this dsn fails!!
> > ### my $dsn = "dbi:Pg:dbname=template1:host:localhost";
This was a typo in my original post, it *did* fail with host=localhost
(That stray colon was a typo in my post, but not in my test script)
> >
> > ###
> > ### For some reason adding host:localhost makes everything die!!!
> >
> > my $dbh = DBI->connect($dsn, "rtuser", "wibble") or die "doh!\n";
>
> Having looked at the perldoc for DBD::Pg I can see that the $dsn which
> died on connecting in this script is wrong. You want something like:
>
> $dsn = "dbi:Pg:dbname=template1;host=localhost;"
>
> Try it again with that dsn and see if you can connect to the database.
Here is the nub of the problem.
I can connect with:
$dsn = "dbi:Pg:dbname=template1;";
but not with
$dsn = "dbi:Pg:dbname=template1;host=localhost;";
(or with the following, I assumed that semicolon was a typo of yours)
$dsn = "dbi:Pg:dbname=template1:host=localhost;";
And of course it is the latter that rt-setup-database wants to use.
The database error I get on my DBI->connect() or die is:
root at request-tracker:~# perl test.pl
DBI connect('dbname=template1;host=localhost;','rtuser',...) failed: could not
connect to server: Connection refused at test.pl line 13
and also:
root at request-tracker:~# perl test.pl
DBI connect('dbname=template1:host=localhost;','rtuser',...) failed: FATAL:
IDENT authentication failed for user "rtuser" at test.pl line 13
By the way, there was a typo in my previous post. That extra colon was,
in fact an = in my script. I have thoroughly double checked everything.
It connects without the host specified, and dies if host=localhost is
in the $dsn.
Jens
More information about the rt-users
mailing list