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

    Exclamation Unanswered: error while connecting to postgresql7.2.1

    Hello,

    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 127.0.0.1] DBI->connect(dbname=template1) failed: connectDBStart() -- socket() failed: errno=2

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

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

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


    Installed:

    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:.


    Details:

    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 127.0.0.1] malformed header from script. Bad header=bin/mozilla: c:/apache/htdocs/sql-ledger/admin.pl

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

    [Thu Jun 20 12:54:45 2002] [error] [client 127.0.0.1] Compilation failed in require at c:\apache\htdocs\SQL-LE~1\admin.pl 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,
    saurabh
    Last edited by saurabhdshah; 06-20-02 at 05:30.

  2. #2
    Join Date
    Sep 2001
    Location
    Vienna
    Posts
    400

    question

    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
    http://www.postgresql.org
    --Postgresql is the only kind of thing--

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

    Any other ideas?

    Thanks in advance.
    regards,
    saurabh

  4. #4
    Join Date
    Mar 2002
    Location
    Pilipinas
    Posts
    36

    Angry

    try this script:
    ==============================================
    #!/usr/bin/perl

    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
  •