Received: from socket.newsnipple.com (postfix@[208.243.144.102]) by hub.org (8.10.1/8.10.1) with ESMTP id e9A6GqJ43623 for ; Tue, 10 Oct 2000 02:16:52 -0400 (EDT) Received: by socket.newsnipple.com (Postfix, from userid 1000) id C43A43588D; Tue, 10 Oct 2000 00:42:12 -0700 (PDT) Date: Tue, 10 Oct 2000 00:42:12 -0700 From: Adam Haberlach To: Deniz Hastorun Cc: pgsql-interfaces@postgreSQL.org Subject: Re: problem connecting with libpq++ interface Message-ID: <20001010004212.C3506@ricochet.net> References: <000d01c031ce$9ed29a00$25054ba0@cc.itu.edu.tr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii User-Agent: Mutt/1.0.1i In-Reply-To: <000d01c031ce$9ed29a00$25054ba0@cc.itu.edu.tr>; from denizh@itu.edu.tr on Mon, Oct 09, 2000 at 11:55:05AM +0300 X-Archive-Number: 200010/60 X-Sequence-Number: 1417 On Mon, Oct 09, 2000 at 11:55:05AM +0300, Deniz Hastorun wrote: > > Hi everybody, > > I have a really strange problem . I'm trying to connect to PostgreSQL db > from witin my C++ program and using the libpq++ interface functions . But > strangely it won't connect and I'm receiving the following error message > > connection to db failed. > Error returned:ERROR: PQconnectdb() - Missing '=' after 'template1' in > conninfo > > .here's my code > PGconn *conn1; > const char * dbname="template1"; > PgDatabase data(dbname); > conn1=PQconnectdb(dbname); > if (data.ConnectionBad()) > { > cerr<<" connection to db failed."<< endl > <<" Error returned:" << data.ErrorMessage() << endl; > exit(1); > } > > any idea would be appreciated. thanks in advance! I think you mean const char * dbname="dbname=template1"; (and you don't need to do the PQconnectdb() , because the PgDatabase object will make the connection for you...) ...hope this helps...have a nice day... -- Adam Haberlach | A billion hours ago, human life appeared on adam@newsnipple.com | earth. A billion minutes ago, Christianity http://www.newsnipple.com | emerged. A billion Coca-Colas ago was '88 EX500 | yesterday morning. -1996 Coca-Cola Ann. Rpt.