Re: [gnome-db] Postgres database connections



On Sat, 2005-02-26 at 21:28 +1100, Robert Bertram wrote:
> Hi all,
> 
> I have been working through the libgda manual getting the feel for the
> code examples. I want to create a PostgreSQL connection and run a simple
> SQL statement on a database. I can't figure out from the documentation
> just what functions I need to do it. Any help would be appreciated. The
> code I'm working on is below.
> 
> Regards,
> 
> Robert.
> 
> 
>     GdaClient *client;
>     GdaServerProvider *provider;
>     GdaConnection *connection;
> 
>     gboolean test;
>     gchar * mySQL = "select * from testing;";
> 
>     client = gda_client_new ();
> 
>     provider = (GdaServerProvider *) "PostgreSQL";
>     g_print("%s\n", provider);
> 
this is wrong, GdaServerProvider is not a string.

>     /* looks good until here then segfaults */
>     /* can't figure out what functions I need here */
> 
>     connection = gda_client_open_connection (client, "foo_ds", "postgres",
> 	                       	"*********",
> GDA_CONNECTION_OPTIONS_READ_ONLY);
> 
>     gda_server_provider_open_connection( provider, connection, NULL,
> "postgres", "**********");
> 
you don't need to use this at all.
-- 
Rodrigo Moya <rodrigo gnome-db org>




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