[gnome-db] Two connections to a database.



Hi,

I want to create two connections to a database, but i have a segfault.
Can i do 2 connections to the same DB, or is it a limit of libgda ( mysql provider ) ?

Thanks

stef debian:~/devel/test_libgda$ gcc test1.c -o test1 `pkg-config --libs --cflags libgda` -g
stef debian:~/devel/test_libgda$ gdb ./test1
GNU gdb 6.1-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-linux"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) run
Starting program: /home/stef/devel/test_libgda/test1
[Thread debugging using libthread_db enabled]
[New Thread 1077795456 (LWP 23712)]
** Message: connection1 [0x80518d0]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1077795456 (LWP 23712)]
0x402ca834 in strcmp () from /lib/tls/libc.so.6
(gdb) bt
#0  0x402ca834 in strcmp () from /lib/tls/libc.so.6
#1  0x08051918 in ?? ()
#2  0x40036f4e in gda_client_find_connection () from /usr/lib/libgda-2.so.1
#3  0x40036a94 in gda_client_open_connection () from /usr/lib/libgda-2.so.1
#4  0x080487bd in do_stuff (user_data=0x0) at test1.c:14
#5  0x400452d0 in gda_init () from /usr/lib/libgda-2.so.1
#6  0x4008ad03 in g_child_watch_add () from /usr/lib/libglib-2.0.so.0
#7  0x40087942 in g_main_depth () from /usr/lib/libglib-2.0.so.0
#8  0x40088a38 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#9  0x40088d70 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#10 0x400893b3 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#11 0x4004538f in gda_main_run () from /usr/lib/libgda-2.so.1
#12 0x08048856 in main (argc=1, argv=0xbffffab4) at test1.c:27
(gdb)

#include <libgda/libgda.h>

void do_stuff (gpointer user_data) {
  GdaClient *gda_client = NULL;

  GdaConnection *connection1 = NULL;
  GdaConnection *connection2 =  NULL;

  gda_client = gda_client_new ();
  if (gda_client) {
    connection1 = gda_client_open_connection (gda_client, "gcontacts-localhost", NULL, NULL, GDA_CONNECTION_OPTIONS_READ_ONLY);
    g_message ("connection1 [%p]", connection1);

    connection2 = gda_client_open_connection (gda_client, "gcontacts-localhost", NULL, NULL, GDA_CONNECTION_OPTIONS_READ_ONLY);
    g_message ("connection2 [%p]", connection2);
    
    
    gda_client_close_all_connections (gda_client);
    g_object_unref (G_OBJECT (gda_client));
  }
  gda_main_quit ();
}


int main (int argc, char **argv) {
  gda_init ("test", "0.1", argc, argv);
  gda_main_run ((GdaInitFunc) do_stuff, NULL);
  return 0;
}


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