# ./dbitest.pl
----- 0 -------------------------------------------------------
DBI connect('','',...) failed: サーバに接続できませんでした: そのようなファイルやディレクトリはありません
ローカルにサーバが稼動していますか?
Unixドメインソケット"/var/run/postgresql/.s.PGSQL.5432"で通信を受け付けていますか? at ./dbitest.pl line 6.
----- 1 -------------------------------------------------------
DBI connect('host=/tmp/.s.PGSQL.5432','',...) failed: サーバに接続できませんでした: ディレクトリではありません
ローカルにサーバが稼動していますか?
Unixドメインソケット"/tmp/.s.PGSQL.5432/.s.PGSQL.5432"で通信を受け付けていますか? at ./dbitest.pl line 8.
----- 2 -------------------------------------------------------
DBI connect('host=/tmp','',...) failed: FATAL: no pg_hba.conf entry for host "[local]", user "root", database "root", no encryption at ./dbitest.pl line 10.
----- 3 -------------------------------------------------------
DBI connect('host=/tmp dbname=test','',...) failed: FATAL: no pg_hba.conf entry for host "[local]", user "root", database "test", no encryption at ./dbitest.pl line 12.
----- 4 -------------------------------------------------------
DBI connect('dbname=test host=/tmp user=no','',...) failed: FATAL: no pg_hba.conf entry for host "[local]", user "no", database "test", no encryption at ./dbitest.pl line 14.
----- 5 -------------------------------------------------------
DBI connect('dbname=test host=/tmp','no',...) failed: FATAL: no pg_hba.conf entry for host "[local]", user "no", database "test", no encryption at ./dbitest.pl line 16.
----- 6 -------------------------------------------------------
ct = [6]
hostの指定がない場合、Unixドメインソケットに接続
Unixドメインソケットが、規定値にない場合、hostに、ディレクトリを指定する。
dbname 及び user の指定がない場合、linuxでログインしているユーザー名になる。
ユーザーの指定は、2番目のパラメータに書いても、1番目にuser=で書いても同じである
ちなみに、
$dbh = DBI->connect('dbi:Pg:', '', '') || die 'err:'.$dbh->err.' ['.$dbh->errstr."]\n";
の実行結果は
DBI connect('','',...) failed: サーバに接続できませんでした: そのようなファイルやディレクトリはありません
ローカルにサーバが稼動していますか?
Unixドメインソケット"/var/run/postgresql/.s.PGSQL.5432"で通信を受け付けていますか? at ./dbitest.pl line 33.
err: []