X-Original-To: pgsql-interfaces-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id DFC609FB365 for ; Mon, 31 Jul 2006 13:16:35 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 04341-01-3 for ; Mon, 31 Jul 2006 13:16:29 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sydney.mailnetwork.co.uk (server88-208-192-113.live-servers.net [88.208.192.113]) by postgresql.org (Postfix) with ESMTP id 150179FB369 for ; Mon, 31 Jul 2006 13:16:15 -0300 (ADT) Received: from andyshellam-gw.adsl.newnet.co.uk ([80.175.198.137]:60968 helo=[192.168.1.15]) by sydney.mailnetwork.co.uk with esmtpa (Exim 4.60) (envelope-from ) id 1G7aRA-00087b-4F; Mon, 31 Jul 2006 17:16:12 +0100 Message-ID: <44CE2CCB.10401@andycc.net> Date: Mon, 31 Jul 2006 17:16:11 +0100 From: Andy Shellam Reply-To: andy@andycc.net Organization: the mail network User-Agent: Thunderbird 1.5.0.5 (X11/20060719) MIME-Version: 1.0 To: =?UTF-8?B?VHXEn2JlcmsgS2FyYQ==?= CC: pgsql-interfaces@postgresql.org Subject: Re: connection problem References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.254 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, NORMAL_HTTP_TO_IP, SPF_HELO_PASS, SPF_PASS X-Spam-Level: X-Archive-Number: 200607/24 X-Sequence-Number: 6214 Try "host=172.16.11.2" at the start of your connection string. I believe the parameter is "host" not "hostaddr". Andy. Tuğberk Kara wrote: > I have a postgresql installed on a remote machine. I want to connect > to it with libpq but the connection is not successful. > I have this piece of code for connection in my c file: > > PGconn *conn=NULL; > char *conn_str="hostaddr=172.16.11.2 port=5432 > dbname=postgres user=postgres password=654321 reqiressl=0"; > conn=PGconnectStart(conn_str); > if(PGstatus(conn)=CONNECTION_BAD){ > > PGerrorMessage(conn); > } > else{ > > printf("connected"); > > } > > But I can not connect. It exits from the program. I tried also > PGconnectdb but it also did not connect to the databse. But I can > connect to it thorough pgAdmin with the same credentials. Can you help > me please urgently!'!!! > > > > !DSPAM:14,44ce2c59143296589895338! -- Andy Shellam , the Mail Network NetServe Support - we don't go the extra mile; we go the whole distance! p: (+44) 0 845 838 0879 / +44 0 7818 000834 w: www.mailnetwork.co.uk e: support@mailnetwork.co.uk