gda-dev does not compile

Mark Johnson mrj001 at shaw.ca
Tue Dec 12 22:33:07 EST 2006


Mark Johnson wrote:

>I've modified the config file as follows:
><?xml version="1.0"?>
><libgda-config>
>    <section path="/apps/libgda/Datasources/SalesTest">
>        <entry name="DSN" type="string" 
>value="URI=/home/phil/.libgda/sales_test.db"/>
>        <entry name="Description" type="string" value="Test database for 
>a sales department"/>
>        <entry name="Password" type="string" value=""/>
>        <entry name="Provider" type="string" value="SQLite"/>
>        <entry name="Username" type="string" value=""/>
>    </section>
>    <section path="/apps/libgda/Datasources/gnucash">
>        <entry name="Description" type="string" value="Test database for 
>gnucash"/>
>        <entry name="Password"    type="string" value="kirk"/>
>        <entry name="Provider"    type="string" value="MySQL"/>
>        <entry name="User"        type="string" value="gnucash"/>
>        <entry name="Host"        type="string" value="enterprise"/>
>        <entry name="DSN"         type="string" value="DB_NAME=gnucash"/>
>    </section>
></libgda-config>
>
>I logged into MySql (as root) and created the user and database.  I did 
>not create tables, assuming that gnucash would create them.
>
>I started gnucash with:
>$ gnucash gda://gnucash
>It indicated that the database did not seem to exist and asked if I 
>would like to create it.  I clicked yes.  Nothing further happened.
>
>The following was printed on my terminal:
>mj at ds9:/opt/gnucash-svn15198/bin$ gnucash gda://gnucash
>
>
>This is a development version. It may or may not work.
>Report bugs and other problems to gnucash-devel at gnucash.org.
>You can also lookup and file bug reports at http://bugzilla.gnome.org
>The last stable version was GnuCash 2.0.2
>The next stable version will be GnuCash 2.2
>
>SQL error: Can't connect to local MySQL server through socket 
>'/tmp/mysql.sock' (2)
>SQL error: Can't connect to local MySQL server through socket 
>'/tmp/mysql.sock' (2)
>
>
>
>The unix socket file is a problem.  It needs a host and port to connect 
>to my db server on another machine.  (The default port is what I am 
>using here.)  I had thought that the entry name for host above would 
>indicate that.
>
>
>  
>
Phil,
I checked the gda documentation and tried adding:
  <entry name="Port"        type="string" value="3306"/>
I was thinking this might convince it to use the network socket rather 
than the unix socket file.  Same result as before.

I tried running gnucash under gdb to see what was being passed to gda's 
gda_client_open_connection.  Here is the results:
(gdb) break gnc-backend-gda.c:1333
Breakpoint 1 at 0xb67a6236: file gnc-backend-gda.c, line 1333.
(gdb) cont
Continuing.
Detaching after fork from child process 3591.
[Switching to Thread -1231022400 (LWP 3583)]

Breakpoint 1, gnc_gda_session_begin (be_start=0x8230f98, 
session=0x844e1b8, book_id=0x8450600 "gda://gnucash",
    ignore_lock=0, create_if_nonexistent=0) at gnc-backend-gda.c:1333
1333            be->pClient = gda_client_new();
(gdb) print *book_id
$1 = 103 'g'
(gdb) print book_id
$2 = (const gchar *) 0x8450600 "gda://gnucash"
(gdb) n
1336            book_info = g_strdup( book_id );
(gdb) n
1337            dsn = strchr( book_info, ':' );
(gdb) print book_info
$3 = (gchar *) 0x8231148 "gda://gnucash"
(gdb) n
1338            *dsn = '\0';
(gdb) print dsn
$4 = (gchar *) 0x823114b "://gnucash"
(gdb) n
1339            dsn += 3;
(gdb) print dsn
$5 = (gchar *) 0x823114b ""
(gdb) n
1340            username = strchr( dsn, ':' );
(gdb) print dsn
$6 = (gchar *) 0x823114e "gnucash"
(gdb) n
1341            if( username != NULL ) {
(gdb) print username
$7 = (gchar *) 0x0
(gdb) n
1344                    username = "";
(gdb) n
1346            password = strchr( username, ':' );
(gdb) n
1347            if( password != NULL ) {
(gdb) print password
$8 = (gchar *) 0x0
(gdb) n
1350                    password = "";
(gdb) n
1353            be->pConnection = gda_client_open_connection( be->pClient,
(gdb) n
1358            g_free( book_info );
(gdb) n
1360            if( be->pConnection == NULL ) {
(gdb) n
1361                    printf( "SQL error: %s\n", error->message );
(gdb) n
1362                    qof_backend_set_error( be_start, 
ERR_BACKEND_NO_SUCH_DB );
(gdb) cont
Continuing.

Program exited normally.
(gdb)

It appears this code is expecting a URI like this:
gda://DSN:username:password
And that the .libgda/config file is not used.

I tried:
$ gnucash gda://gnucash:gnucash:kirk
But then it complained that the database gnucash:gnucash:kirk did not 
exist, and printed the errors about the socket file again.

I need help connecting.  I am able to run the MySql query browser and 
administrator programs from this machine, so it can definitely connect 
to the db server.

Thanks,
Mark






More information about the gnucash-devel mailing list