Обсуждение: pqxx::Connection("dbname=name");

Поиск
Список
Период
Сортировка

pqxx::Connection("dbname=name");

От
"CG"
Дата:
Hi,

i tried to create a pqxx::Connection with an NOT existing dbserver and my
program aborts.

Is this correct?

try
{   Connection c("dbname=wrongname"
}
catch(const exception &ec)
{   cout << " Connection failed! " << endl;
}

Why does it not catch in my program?

Thanx in advance!

CG






Re: pqxx::Connection("dbname=name");

От
jtv
Дата:
On Thu, Jun 27, 2002 at 05:00:22PM +0200, CG wrote:
> 
> i tried to create a pqxx::Connection with an NOT existing dbserver and my
> program aborts.
> 
> Is this correct?

Obviously not!  The most likely explanation is that you linked your
program with a dynamic version of libpqxx, and either:

(1) the library and your program were compiled with different compilers
or different versions of the same compiler; or

(2) the system loader could not find the dynamic pqxx library.

I'd have to know which platform you're on and which compiler(s) you're
using to say more, but one thing you could try right away is *not*
including libpqxx in the libraries to link with, but linking in the
static version of the library as if it were a normal object file.  This
should be possible on most platforms; this version of the library will
be called LIBPQXX.LIB on Windows or libpqxx.so on pretty much any other
system.


Jeroen





Re: pqxx::Connection("dbname=name");

От
jtv
Дата:
On Fri, Jun 28, 2002 at 04:25:50PM +0200, jtv wrote:
> 
> I'd have to know which platform you're on and which compiler(s) you're
> using to say more, but one thing you could try right away is *not*
> including libpqxx in the libraries to link with, but linking in the
> static version of the library as if it were a normal object file.  This
> should be possible on most platforms; this version of the library will
> be called LIBPQXX.LIB on Windows or libpqxx.so on pretty much any other
> system.

Oops.  Of course I meant libpqxx.a when I wrote libpqxx.so!


Jeroen