Re: I couldn't compile my gnome-db application!!!
- From: Rodrigo Moya <rodrigo linuxave net>
- To: Carlos Perelló Marín <carlos hispalinux es>
- Cc: gnome-db-list gnome org
- Subject: Re: I couldn't compile my gnome-db application!!!
- Date: Sun, 30 Jul 2000 23:59:06 +0200
Carlos Perelló Marín wrote:
>
> Hello, this weekend i began an application to manage a radio station and
> when i try to add a simple gnome-db support it gaves me some errors.
>
> First, i'm using the official gnome-db-0.0.96. I want use it with
> PostgreSQL. When i want compile the application the gda.h gave me an
> error, because (i think) all the gnome-db's *.h are wrong? they must
> include the .h as <gda/gda*.h> but they use <gda*.h>, why???.
>
you should use the gda-config script (which works exactly as
glib-config, gtk-config, gnome-config...). So, when compiling:
gcc -o file.o `gda-config --cflags client-ui` -c file.c
to link:
gcc -o file `gda-config --libs client-ui` file.o
I'm not sure if the 0.0.96 supports 'client-ui`, so if not, use gdaui
instead. Anyway, if you run gda-config with no parameters, it will show
a help screen with all the available libraries.
> When i correct this, error?, then i began to compile my application (i
> have stolen all the gASQL's code to include the gnome-db support at
> configure.in and Makefile.am, sorry Vivien :-) ). But it gaves me a lot
> of errors, it can find the functions definitions. I don't know what i
> must do, here are the function i have write to make the test:
>
> #include <gda/gda.h>
> void
> on_login_ok_button_clicked (GtkButton *button,
> gpointer user_data)
> {
> gchar *user, *pass;
> GtkWidget *userw, *passw;
> Gda_Connection *connection;
>
> userw = glade_xml_get_widget (xml,"login_user_entry");
> passw = glade_xml_get_widget (xml,"login_pass_entry");
> user = gtk_entry_get_text (GTK_ENTRY(userw));
> pass = gtk_entry_get_text (GTK_ENTRY(passw));
> gda_connection_set_provider(GDA_CONNECTION(connection), "PostGres");
> gda_connection_open(GDA_CONNECTION(connection), NULL, user, pass);
> printf("I have connected!!\n");
> gda_connection_close(GDA_CONNECTION(connection));
> }
>
> I don't know if this is the perfect way to stablish the connection, but
> i 'm making test and i couldn't compile, when i compile the program i
> will try to improbe this.
>
no, it's not. First of all, you must create the Gda_Connection object,
which it does not appear to be created in this code. So,
Gda_Connection* connection = gda_connection_new(gnome_CORBA_ORB());
gda_connection_set_provider(connection, "gda-postgres");
gda_connection_open(connection, "DSN=dbname;HOST=localhost", user,
pass);
But, as I see you're making your own dialog for connecting, why don't
you use the GnomeDbLoginDialog widget? it is there for helping you!! You
can see how to use it in gASQL,
in gda-fe/, in gda-rolodex/ and in the testing/glade/db_login directory.
And as I also see that you're using libglade, you may want to put the
GnomeDb-specific widgets directly in your form designed in Glade. This
is supported in the CVS version of Glade. They are not very advanced,
you can only put them in the resulting .glade file, so you may also want
to hack on this code to make them useful when using them from glade.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]