PDA

View Full Version : Embedded Mysql Windows Qt4.1



benguela
1st June 2006, 09:44
Hi,

I'm trying to open an embedded mysql database on windows using the qt mysql plugin that I compiled using the libmysqld library.

My qt code is as follows:

db = QSqlDatabase::addDatabase("QMYSQL");
db.setDatabaseName("test");
bool ok = db.open();

db.open() always returns false.

I tried putting the my.ini file into my HOME directory, into c:\ and into my application's directory. I also tried renaming the file to my.cnf and .my.cnf
I even went as far as creating a HOME environment variable to point to these directories and out of sheer desperation I tried a MYSQL_HOME variable.

Any ideas?

Thanks
- Pablo.

wysota
1st June 2006, 15:44
I'm not sure if you can use QMYSQL to connect to an embed database server. How do you do it from plain C+libmysqlclient?

benguela
2nd June 2006, 06:30
In the qt docs it explains how to compile their driver linking it with the embedded mysql library , libmysqld.dll, so it can be done. I'm currently going through the "roll my own" mysql 5.0.22 from the source trying build another libmysqld.dll, this from a hint I read on the mysql forums, it's a long shot but I've nothing else to try. Of course the mysql source has linking errors, such endeavors are never easy :(

wysota
2nd June 2006, 09:49
And did you link the Qt driver with the embedded library?

benguela
2nd June 2006, 11:47
yes of course, that was the first thing I did.

crocus
16th January 2007, 14:57
Commented #define, compiled -plugin there and visible, but when start program bug reading memory, the question of how to correct initialize /run in the embedded MySql from program, not alone how in the example of the dock MySQL - with #include <mysql.h>?? And what write in the 'HostName??
P.S. Translated with http://translate.google.com/ from Russian

Methedrine
16th January 2007, 16:10
Did you place the QMysql Plugin in the correct folder? (i.e. AppPath/plugins/sqldrivers/)

crocus
17th January 2007, 01:13
Of course!!