Re: [gnome-db] How to use with SQLite ?
- From: Juan Manuel Mouriz <jmouriz gmail com>
- To: e-Jah <e-Jah ejahworld net>
- Cc: gnome-db-list gnome org
- Subject: Re: [gnome-db] How to use with SQLite ?
- Date: Wed, 3 Aug 2005 11:31:15 -0300
Try make this source (gcc -o test test.c `pkg-config --cflags --libs
libgda-2.0`):
/* START */
/* Copyright (C) 2003 The GNOME Foundation
* Alvaro del Castillo <acs barrapunto com>
*/
#include <libgda/libgda.h>
/* Show errors from a working connection */
static void
get_errors (GdaConnection *connection)
{
GList *list;
GList *node;
GdaConnectionEvent *error;
list = (GList *) gda_connection_get_events (connection);
for (node = g_list_first (list); node != NULL; node =
g_list_next (node)) {
error = (GdaConnectionEvent *) node->data;
g_print ("Error no: %d\t",
gda_connection_event_get_code (error));
g_print ("desc: %s\t",
gda_connection_event_get_description (error));
g_print ("source: %s\t",
gda_connection_event_get_source (error));
g_print ("sqlstate: %s\n",
gda_connection_event_get_sqlstate (error));
}
}
int
main(int argc, char *argv[])
{
/* General GDA variables */
GdaClient *client;
GdaConnection *connection;
/* Connection data */
gchar *datasource = "mySQLiteDB";
gchar *username = "";
gchar *password = "";
/* 1. The first: init libgda */
gda_init ("test", NULL, argc, argv);
/* 2. Create a gda client */
client = gda_client_new ();
/* 3. Open the connection */
connection = gda_client_open_connection (client, datasource,
username, password, 0);
if (!GDA_IS_CONNECTION (connection))
{
g_error ("Could not open connection to %s\n", datasource);
get_errors (connection);
return 0;
}
/* 4. DO SOMETHING */
/* 5. Close the connection */
gda_connection_close (connection);
/* 6. Free memory */
g_object_unref (G_OBJECT (client));
return 0;
}
/* END */
And tell what happens.
2005/8/3, e-Jah <e-Jah ejahworld net>:
> Le mercredi 03 août 2005 à 13:49 +0200, Vivien Malerba a écrit :
> > On 8/3/05, e-Jah <e-Jah ejahworld net> wrote:
> > > Hi,
> > >
> > > I try to access to my SQLite database with mergeant, but when i click on
> > > connect i get the message error "could not open the connection to the
> > > DBMS for datasources 'mySQLiteDB'"
> > >
> > > My ~/.libgda/config is :
> > > $ cat ~/.libgda/config
> > > <?xml version="1.0"?>
> > > <libgda-config>
> > > <section path="/apps/libgda/Datasources/mySQLiteDB">
> > > <entry name="DSN" type="string"
> > > value="URI=/home/ejah/Coding/Gecca/Gecca/Camps/Camps.db"/>
> > > <entry name="Description" type="string" value="Test of SQLite
> > > provider"/>
> > > <entry name="Password" type="string" value=""/>
> > > <entry name="Provider" type="string" value="SQLite"/>
> > > <entry name="Username" type="string" value=""/>
> > > </section>
> > > </libgda-config>
> > >
> >
> > Can you tell me about the versions of libgda/libgnomedb/mergeant you are using?
>
> Of course:
> ii libgda2-1 1.1.99-1 GNOME Data Access library for GNOME2
> ii libgnomedb2-3 1.1.99-1ubuntu Database UI widget library for GNOME2
> ii mergeant 0.52-1~5.04ubp GNOME Database admin tool GUI for
> GNOME2
>
> $ mergeant --version
> Gnome mergeant 0.52
>
> For the database I try with a sqlite db and a sqlite3 db and the results
> are the same.
>
> --
> Guillaume aKa e-Jah
>
>
> _______________________________________________
> gnome-db-list mailing list
> gnome-db-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-db-list
>
--
Juan Manuel Mouriz
Buenos Aires
Argentina
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]