Re: [gnome-db] please help connecting to databse



On Fri, 2004-11-05 at 23:59 -0700, Neil Zanella wrote:
> Hello,
> 
> I am not sure what I am doing wrong, but I am trying to connect to a PostgreSQL
> database. I issue the following:
> 
> gchar *provider = "PostgreSQL";
> gchar *cnc_string = "HOST=localhost;PORT=5432;DATABASE=joedb;USER=joedoe";
> 
> connection = gda_client_open_connection_from_string(client,
>     provider, cnc_string, (GdaConnectionOptions) 0);
> 
> gchar *query = "INSERT INTO JPeople (jperson) VALUES ('Jane Dane')";
> 
>  command = gda_command_new (query,
>                                    GDA_COMMAND_TYPE_SQL,
>                                    GDA_COMMAND_OPTION_STOP_ON_ERRORS);
> 
> CRITICAL **: file gda-connection.c: line 754
> (gda_connection_execute_command): assertion GDA_IS_CONNECTION (cnc)'
> failed
> 
that's because the connection attempt failed. You can connect to the
"event_notification" signal on the GdaClient, which will be emitted if
an error occurs while trying to connect. You'll get an error message
which will tell you what failed.
-- 
Rodrigo Moya <rodrigo gnome-db org>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]