Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2002

    Exclamation Unanswered: error while connecting to postgresql7.2.1


    Problem statement: I m getting following error while connecting to postgresql7.2.1 through DBD:Pg :

    [Thu Jun 20 13:15:50 2002] [error] [client] DBI->connect(dbname=template1) failed: connectDBStart() -- socket() failed: errno=2

    [Thu Jun 20 13:15:50 2002] [error] [client] No such file or directory

    [Thu Jun 20 13:15:50 2002] [error] [client] Error: <br>connectDBStart() -- socket() failed: errno=2<br>No such file or directory<br>

    [Thu Jun 20 13:15:50 2002] [error] [client] Compilation failed in require at c:\EZPUBL~1\apache\htdocs\SQL-LE~1\ line 93.


    I have Windows 2000 os. And have postgresql7.2.1 installed on cygwin on drive i:. Also I have active perl and apache installed on drive c:.


    Now I think we have to check the problem step by step.

    +--------+ +--------+ +------------+ +-----------+
    | Script +-->+ DBI +---+-->+ DBD Postgre+--->+ Postgre DB|
    +--------+ +--------+ +------------+ +-----------+
    A Script
    B Connection Script -> DBI
    C DBI
    D Connection DBI -> DBD-Pg
    E DBD-pg
    F Connection DBD-Pg ->Postgre DB
    G Postgre DB

    (A) Script is perfectly allright. -- no problem (if you have got any other sample script to test connection of DBD-pg and postgresql then pls send to me)

    (B) I uninstalled DBI -- its giving me proper error that "DBI not installed". And after I again install the error does not come. So -- no problem

    (C) dbi is installed and same as B -- no problem

    (D) when I uninsalled DBD-pg it gave be these errors:

    [Thu Jun 20 12:54:45 2002] [error] [client] malformed header from script. Bad header=bin/mozilla: c:/apache/htdocs/sql-ledger/

    [Thu Jun 20 12:54:45 2002] [error] [client] Unknown error

    [Thu Jun 20 12:54:45 2002] [error] [client] Compilation failed in require at c:\apache\htdocs\SQL-LE~1\ line 93.

    In the first error again there seems to be some path problem -- u all must be knowing better. Again if I install dbd-pg these errors go away and the prime error (in the very top of email) comes. But lets keep this -- A SUSPECT

    (E)DBD-Pg . Is there some setting to be done to let DBD-Pg about where the postgre sql is (eg. Port of postgresql or the pid or the socket '/tmp/.s.PGSQL.5432')? Lets also keep this -- A SUSPECT

    (F)Same as E -- A SUSPECT

    (G)Postgresql7.2.1 has been installed. I can access template1 and can create table through psql. --- no problem

    That leaves us with three suspects:
    (D) Connection from DBI to DBD-Pg
    (E) DBD-Pg settings etc.
    (F) Connection from DBD-Pg to postgre

    Any ideas?

    Thanks and regards,
    Last edited by saurabhdshah; 06-20-02 at 06:30.

  2. #2
    Join Date
    Sep 2001


    I'm not so familiar with perl-Postgres-windows

    But maybe yiou have not startet the postmester with -i optino to accept TCPIP Connections.

    when you connect with psql postgres uses socket connection
    --Postgresql is the only kind of thing--

  3. #3
    Join Date
    Jun 2002
    I m already starting postgre with -i option.

    Any other ideas?

    Thanks in advance.

  4. #4
    Join Date
    Mar 2002


    try this script:

    use DBI;
    use vars qw($dbh);

    ############## database_name "dbi" #############
    $dbh ||=DBI->connect("dbi:Pg:dbname=dbi");

    my $Command="select first_name,last_name from people order by last_name, first_name";

    my $sth=$dbh->prepare($Command);
    my $Result=$sth->execute;

    while (my @row_ary = $sth->fetchrow_array)
    print "$row_ary[0] $row_ary[1]\n";
    print "sth = $sth\n";
    print "dbh = $dbh\n\n";

    remember to create your database first... with data into it.
    --- Hey! its me!!! the MaleMan ---

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts