Unix Technical Forum

libpqxx + postgresql connection

This is a discussion on libpqxx + postgresql connection within the pgsql Admins forums, part of the PostgreSQL category; --> Hi all, I am using libpqxx to connct to Pgsql database. Following is my code in a connect method ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Admins

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 06:27 AM
LiveShell
 
Posts: n/a
Default libpqxx + postgresql connection

Hi all,
I am using libpqxx to connct to Pgsql database. Following is
my code in a connect method of a class

try
{
conninfo = "host=127.0.0.1 dbname = DatabaseName user=uname";
conn = new connection(conninfo);

}
catch (const sql_error &roSqlQueryError)
{
printf("In Error \n");
string szQueryError = roSqlQueryError.what();
szQueryError += "Query was:: ";
szQueryError += roSqlQueryError.query();
throw runtime_error(szQueryError);
}

But when i use this connection in later stage it results to segmentation
fault.

I changed database name to wrong dbname (non existing database) then also it
doesnt go to catch staatement...

Can ny body tell me what is teh problem with this????

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 06:27 AM
Andy Shellam
 
Posts: n/a
Default Re: libpqxx + postgresql connection

You might be better off asking this on the pgsql-interfaces list -
that's geared more towards programming with libpq and other interfaces.

Andy.

LiveShell wrote:
> Hi all,
> I am using libpqxx to connct to Pgsql database.
> Following is my code in a connect method of a class
>
> try
> {
> conninfo = "host=127.0.0.1 <http://127.0.0.1/> dbname =
> DatabaseName user=uname";
> conn = new connection(conninfo);
>
> }
> catch (const sql_error &roSqlQueryError)
> {
> printf("In Error \n");
> string szQueryError = roSqlQueryError.what();
> szQueryError += "Query was:: ";
> szQueryError += roSqlQueryError.query();
> throw runtime_error(szQueryError);
> }
>
> But when i use this connection in later stage it results to
> segmentation fault.
>
> I changed database name to wrong dbname (non existing database) then
> also it doesnt go to catch staatement...
>
> Can ny body tell me what is teh problem with this????
>
> !DSPAM:37,44cf30d8143291881918933!



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:38 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com