GDA: trouble with MySql

Mark Johnson mrj001 at
Sat Feb 2 09:50:01 EST 2008

Mark Johnson wrote:
> Phil,
> I wanted to try gnucash-gda with MySql.  I suspect the postgresql 
> provider of poor performance and wanted to see how the performance of 
> MySql compared. 
> I have created the db manually and tested the gda connection with 
> gnome-database-properties-3.0 successfully.
> I am using the latest svn of gda-dev2 and libgda-3.1.2.
> However, when I choose File->Database connection and select the MySql 
> database, I get two dialog boxes (one after the other) indicating that 
> the db (gda://@GnucashMySql) does not seem to exist and asking if I 
> would like to create it.  I choose yes each time, but nothing happens.  
> Afterwards, I connect to MySql and check the gnucash db; it still has  
> no tables.
> Any suggestions?
> Mark
I traced this problem into gnc-backend-gda.c. At line 245, I discovered 
the actual error was:
"Access denied for user 'mj'@'ds9.mrj' (using password: NO)"

This is obviously something returned by MySql. At line 142, the call to 
gda_client_open_connection has failed. The username and password passed 
to this function were both empty strings. I assumed this would be OK as 
libgda's config file contains the correct username and password 
information and the gnome-database-properties-3.0 program successfully 
tests the connection. However, it seems that these parameters being 
empty strings causes the problem.

 From the GDA documentation:
The username and password used to actually open the connection are the 
first non-NULL string being chosen by order from
-the username or password
-the username or password sprcified in the DSN definition
-the USERNAME= and PASSWORD= parts of the connection string in the DSN 

Changing lines 114 & 115 of gnc-backend-gda.c to:
gchar* username = NULL;
gchar* password = NULL;
has helped. The error message is no longer displayed. And gnucash 
appears to be saving my test data to MySql. I am not sure this is the 
best fix because there are three different possibilities for supplying 
the username and password, and I expect different users to do it 
differently. Certainly, something better needs to be done around the 
username/password for the db.

Also, the message displayed by gnucash is misleading. It should be fixed 
to show the actual error.


More information about the gnucash-devel mailing list