From tugberkkara@gmail.com Mon Jul 31 07:18:56 2006 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 DAC759FB354 for ; Mon, 31 Jul 2006 04:18:56 -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 58391-01 for ; Mon, 31 Jul 2006 04:18:53 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nz-out-0102.google.com (nz-out-0102.google.com [64.233.162.197]) by postgresql.org (Postfix) with ESMTP id 406C79FB34E for ; Mon, 31 Jul 2006 04:18:22 -0300 (ADT) Received: by nz-out-0102.google.com with SMTP id i11so165063nzi for ; Mon, 31 Jul 2006 00:18:20 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=WK/C9gyGibb4T3LeK3JNSXSJqxNQDakrXxblN3mE4uxkk4itlWzat9D9chMKUDXNWC7z5qpL+Av+arQfO+6PbIcZ7sT8ZBWDSeCD53AS3DIPwpeNLi7zfDKK6wAaUnURf1RSwJajmx/xKIuIldLEOjMNLJzDCpK7N4FqYRaXFdM= Received: by 10.65.251.1 with SMTP id d1mr2195235qbs; Mon, 31 Jul 2006 00:18:19 -0700 (PDT) Received: by 10.35.86.8 with HTTP; Mon, 31 Jul 2006 00:18:18 -0700 (PDT) Message-ID: Date: Mon, 31 Jul 2006 10:18:18 +0300 From: "=?ISO-8859-9?Q?Tu=F0berk_Kara?=" To: pgsql-interfaces@postgresql.org Subject: connection problem MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_42438_21687802.1154330298385" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.749 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, HTML_30_40, HTML_MESSAGE, NORMAL_HTTP_TO_IP, SPF_PASS X-Spam-Level: X-Archive-Number: 200607/23 X-Sequence-Number: 6213 ------=_Part_42438_21687802.1154330298385 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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!'!!! ------=_Part_42438_21687802.1154330298385 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
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!'!!!
 
 
 
------=_Part_42438_21687802.1154330298385-- From andy@andycc.net Mon Jul 31 16:16:35 2006 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 From yazicivo@ttnet.net.tr Tue Aug 1 06:35:05 2006 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 2B9B39FB3A7 for ; Tue, 1 Aug 2006 03:35:05 -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 79837-03-4 for ; Tue, 1 Aug 2006 03:34:29 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from fep05.ttnet.net.tr (mail.ttnet.net.tr [212.175.13.129]) by postgresql.org (Postfix) with ESMTP id 242909FB3DF for ; Tue, 1 Aug 2006 03:04:58 -0300 (ADT) Received: from by AVGW-I-1.ttnet.net.tr via smtp id 1ce6_a928d88e_2123_11db_9a78_001422175f0e; Tue, 01 Aug 2006 09:04:58 +0300 Received: from alamut ([212.174.26.173]) by fep05.ttnet.net.tr with ESMTP id <20060801060451.NRME10864.fep05.ttnet.net.tr@alamut>; Tue, 1 Aug 2006 09:04:51 +0300 Date: Tue, 1 Aug 2006 09:02:52 +0300 From: Volkan YAZICI To: =?utf-8?Q?Tu=C4=9Fberk?= Kara Cc: pgsql-interfaces@postgresql.org Subject: Re: connection problem Message-ID: <20060801060252.GA1323@alamut.tdm.local> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.605 tagged_above=0 required=5 tests=AWL, RAZOR2_CF_RANGE_51_100, RAZOR2_CF_RANGE_E8_51_100, RAZOR2_CHECK, SPF_PASS, UNPARSEABLE_RELAY X-Spam-Level: * X-Archive-Number: 200608/1 X-Sequence-Number: 6215 On Jul 31 10:18, Tuğberk Kara wrote: > 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"); > > } You're using totally wrong functions. There's even doesn't exist a function called PGconnectStart(). First of all, I'd suggest you to either reading libpq manual[1] in the PostgreSQL documentation or "PostgreSQL ile Programlama"[2] (in Turkish) book's C API related section. [1] www.postgresql.org/docs/current/interactive/libpq.html [2] http://www.students.itu.edu.tr/~yazicivo/doc/postgresql-ile-programlama-20060214.pdf Regards.