Re: DBI.pm connects with 'use DBI' to a PostgreSQL server without credentials

Mark Lawrence via dbi-users <[email protected]> Tue, 28 Nov 2023 11:14:35 +0000
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <[email protected]>
> the 'use DBI;' already does a connect to the server and tries to read 
> the names of the available databases from the server:

I would check this assumption, because it strikes me as extremely 
unlikely. DBI does not load any drivers at use or require/import time.

You could add some tracing statements of your own to confirm. See the 
"trace_msg" method for example, which you could call directly after the 
"use DBI" statement, to put something in your trace file.

>    <- install_driver= DBI::dr=HASH(0x3926378)
>    !! The warn '0' was CLEARED by call to data_sources method
>       ERROR: 1 'connection to server at "sisis-db" (172.16.6.3), port 5432 failed: FATAL:  no pg_hba.conf entry for host "172.16.5.3", user "nobody", database "postgres", no encryption' (err#0)
>    <- DESTROY(DBI::db=HASH(0x391fc98))= ( undef ) [1 items] at Pg.pm line 264
>    !! ERROR: 1 'connection to server at "sisis-db" (172.16.6.3), port 5432 failed: FATAL:  no pg_hba.conf entry for host "172.16.5.3", user "nobody", database "postgres", no encryption' (err#0)
>    <- data_sources= ( ) [0 items] at DBI.pm line 1074

This appears to be the result of a call to DBI->data_sources(). Are you 
calling that somewhere?

-- 
Mark Lawrence