Skip site navigation (1) Skip section navigation (2)

Attempt to connect to database using libpq++ PgDatabase class fails because CONNECTION_BAD

From: "Paul Meisenheimer" <Paul(dot)Meisenheimer(at)digeo(dot)com>
To: <pgsql-interfaces(at)postgresql(dot)org>
Cc: "Paul Meisenheimer" <Paul(dot)Meisenheimer(at)digeo(dot)com>
Subject: Attempt to connect to database using libpq++ PgDatabase class fails because CONNECTION_BAD
Date: 2002-08-27 23:08:07
Message-ID: 4C568C6A13479744AA1EA3E97EEEB3231F0B08@schumi.digeo.com (view raw or flat)
Thread:
Lists: pgsql-interfaces
I am porting code from Red Hat Linux to Windows 2000 and can not connect to a 
my database using libpq++.

I have installed CygIPC and PostgreSQL as Services on my Windows 2000 PC.
I have created a database (called mediadb).
I have added tables to the database.
I have added data to the tables.

I can access the database using psql from a Cygwin Bash Shell (e.g.):

	$psql -q -d mediadb -U mediadbuser

	mediadb=# select count(*) from guide_programinfo;
	 count
	-------
	 24532
	(1 row)

I can not access the database from my application using libpq++ (CONNECTION_BAD):

	#include <stdio.h>
	#include <iostream>
	#include <string>
	#include "libpq++\pgdatabase.h"

	using namespace std;

	int main(int argc, char* argv[])
	{
		PgDatabase myDB("dbname=mediadb user=mediadbuser");

		if ( myDB.ConnectionBad() )
		{
>>>			cout << "Failed to open <dbname=mediadb user=mediadbuser>" << endl;
		}
		else
		{
			cout << "Opened <dbname=mediadb user=mediadbuser>" << endl;
		}

		return 0;
	}

I am using standard (unmodified) configuration files:

	C:\cygwin\usr\share\postgresql\data\pg_hba.conf
	C:\cygwin\usr\share\postgresql\data\postgresql.conf
	...

Any help would be greatly appreciated!





pgsql-interfaces by date

Next:From: William WestDate: 2002-08-28 00:11:58
Subject: Re: ECGP - varchar in struct?
Previous:From: Bruce MomjianDate: 2002-08-27 21:07:18
Subject: Re: libpgtcl modifications

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group