[gnome-db] Starting GnomeDB on FreeBSD to administer PostGreSQL...
- From: "Dennis B." <dcswest flashmail com>
- To: <gnome-db-list gnome org>
- Subject: [gnome-db] Starting GnomeDB on FreeBSD to administer PostGreSQL...
- Date: Wed, 6 Feb 2002 11:24:11 -0800
Hello Again;
Wrote about this a while back and received some helpful responses, but
nevertheless decided to wait for some further releases before just
intuitively trying it again... And I'm still having problems just
apparently even starting GnomeDB-0.2.90_3 on FreeBSD version 4.4 to
administer PostGreSQL-7.1.3!!!
Not sure if it's a matter of starting GnomeDB a certain way as opposed to
just double-clicking the various binaries, such as gnomedb-fe without any
arguments, and/or if it's even a matter of being logged in to FreeBSD a
certain way and/or if it's just a matter of starting PostGreSQL a certain
way, but wondering at this point if there's any further documentation about
this to which you can maybe point me, beyond what I currently find on the
GnomeDB website and/or in the PostGreSQL
Developer's Handbook... Found the following documentation once too, but if
it's really that complicated, then it's probably just beyond the scope of
what I can currently really even do!!!
Thank you again and have a great day,
This next listing shows you how to connect to PostgreSQL using GNOME-DB.
Notice that you have to take a brief drink from the CORBA well to create a
connection. This is because GNOME uses a high-performance CORBA
implementation called ORBit (GNOME also provides the OAF Library to make it
easy to deal with CORBA).
GdaConnection* cnc;
gchar *pg_provider = "OAFIID:GNOME_GDA_Provider_Postgres_ConnectionFactory";
/* Initialize GNOME-DB */
gnome_db_init("db_connect", "0.1", argc, argv);
/* Use the ORB to create a new connection object. */
cnc = gda_connection_new(gda_corba_get_orb());
/* Make a connection to the database. */
gda_connection_set_provider(cnc, pg_provider);
gda_connection_open(cnc, "DATABASE=bjepson", "bjepson", "");
In GNOME-DB, you also create a command and associate it with a connection
and an SQL statement:
/* Create a command */
GdaCommand *cmd = gda_command_new();
gda_command_set_connection(cmd, cnc);
gda_command_set_text(cmd, "SELECT name FROM contact");
Instead of a data reader, you put the results into a record set:
GdaRecordset *rs;
glong rc;
/* Execute the command */
rs = gda_command_execute(cmd, &rc, 0);
/* Display the results. */
gda_recordset_move_first(rs);
while (!gda_recordset_eof (rs)) {
/* Retrieve the name field. */
GdaField *name = gda_recordset_field_name(rs, "name");
g_print ("Name = %s\n", gda_stringify_value(NULL, 0, name));
/* Move to the next row. */
gda_recordset_move_next (rs);
}
GNOME does things slightly differently. Instead of using the command object
and helper classes, you can associate the result set with a GNOME-DB grid.
When you create the grid, you need to pass the result set into its
constructor (shown in bold ). That's all the magic that's required to fill a
grid with data (shown in Figure 2). This example shows how you can create
the grid and display it in a GTK+ window:
GtkWidget* window; /* a window */
GtkWidget* grid; /* a data grid */
/* Create the window. */
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(window), 300, 200);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]