Re: PostgreSQL Connection Problem

Murray Cumming wrote:
On Fri, 2008-03-28 at 11:03 -0500, inbox_pub earthlink net wrote:
I am trying to use libgnomedbmm to connect to a PostgreSQL database.
I am using a global ODBC connection with the DSN=playback.
When I compile, I get no errors.
However, when I run the program, I get this error message:
   Data source playback not found in configuration

I based the code off of the "simple example" in the "Programming with 
libgnomedbmm" book.

Here is the code through the connect statement:

#include <iostream>
#include <libgnomedbmm.h>
#include <gtkmm.h>

int main(int argc, char* argv[])
        Gtk::Main kit(argc, argv);
        Gnome::Db::init("playback", "1.0", argc, argv);

        Glib::RefPtr<Gnome::Gda::Client> client = 

        Glib::RefPtr<Gnome::Gda::DataModel> model;

        // Create a connection to an example SQLite database. The 
function might
        // fail, so we have to catch potential exceptions.
                // Glib::RefPtr<Gnome::Gda::Connection> connection = 
                // "SQLite", "DB_DIR=" LIBGNOMEDB_DATADIR 
";DB_NAME=demo_db", "" /* username */, "" /* password */);
                // Use PostgreSQL through ODBC instead . . .            
                Glib::RefPtr<Gnome::Gda::Connection> connection = 

You seem to not be calling both open_connection_from_string() and
calling open_connection() instead. The example doesn't do this:

open_connection() takes a DSN (data source name), but you have not
created any such data source in the configuratoin:

Personally, I just use open_connection_from_string() and ignore the
DSN/config system.

I never could get the open_connection_from_string to work, and I could find very little information on the Web. The Reference pages helped but were not as verbose as I would like (being a GUI beginner). I never found a definition for "provider_id". I found a Web page that had something similar to what I thought I needed and patterned mine after it.

OpenOffice Data works well with ODBC connection that I have set up and so I know that part works. Will you please show me what the open_connection_from_string statement should be from the one that I used in the program section above?

Thank you.

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