Re: [gnome-db] Postgres database connections



Robert Bertram said:
> 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);
>
>     /* 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", "**********");
>
>
>     /* just want to see if I can run an SQL statement */
>     test = execute_sql_command (connection, mySQL);
>
>     gda_client_close_all_connections (client);
>     g_object_unref(G_OBJECT(client));
>     gda_main_quit();
> _______________________________________________
> gnome-db-list mailing list
> gnome-db-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-db-list
>

Running gdb and playing around with it it looks like the provider setup is
not right.






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