Re: [gnome-db] an application using libgda2



On Mon, 2003-05-05 at 08:38, Marco Milanesi wrote:
> > > hi, I'm searching an application that uses libgda2 and in particular
> > > gda_client_open_connection cause I'm trying (unsuccesfully) to connect
> > > to PostgreSQL database.
> > 	What does it happen?
> 
> I make:
> 
> gda_config_save_data_source ("postgres", "PostgreSQL",
> 		"DATABASE=PUB",
> 		"Database of PUB's Ubiquitous Beer",
> 		NULL,
> 		NULL);
> 
> gda_init("TestGDA", "0.1", argc, argv);
>
gda_init needs to be the first libgda call in your application, so you
should move the gda_config_save_data_source right after gda_init.

Apart from that, have you tried adding a HOST or HOSTADDR parameter to
the connection string? That is, make it be
"DATABASE=PUB;HOSTADDR=127.0.0.1"

> client = gda_client_new ();
> 
> connection = gda_client_open_connection(client, "postgres", NULL, NULL, 0);
> if (connection == NULL) {
> 	fprintf(stderr, "Can't connect via gda\n");
> 	exit(EXIT_FAILURE);
> }
> 
> but I get always a NULL connection.
> 
if you connect to the "error" signal on the GdaClient, you'll get a
description of the error. This should help you in finding out what the
problem is.

> I need an example that works, thank you :)
> 
in libgda/testing you've got code that works. Which is what you're
doing, so it seems it's not a code problem, but a problem with the way
you're accessing the database (connection string, I'd say).

cheers




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