Can't open a mysql-db on pi
-
I'm trying to open and access a mysql-db on a pi. I've built a cross development environment and it works fine.
The problem now is this snippet:dbAbholer.addDatabase("QMYSQL");
dbAbholer.setHostName("localhost");
dbAbholer.setDatabaseName("test");
dbAbholer.setUserName("user");
dbAbholer.setPassword("password");
bool ret = dbAbholer.open();
qDebug() << ret;
qDebug() << "---------------------------";
qDebug() << dbAbholer.lastError().text();
qDebug() << "---------------------------";
qDebug() << qApp->libraryPaths();
qDebug() << QSqlDatabase::drivers();The output is:
Unable to query physical screen size, defaulting to 100 dpi.
To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
false"Driver not loaded Driver not loaded"
("/usr/local/Qt-5.5.1-raspberry/plugins", "/home/pi")
("QSQLITE", "QSQLITE2", "QMYSQL", "QMYSQL3", "QTDS", "QTDS7")The access to the db should work, i've tried it via mysql-command line.
Whats wrong with my code?
-
Hi and welcome to devnet,
addDatabase is a static method that's why it didn't work. However, didn't you got a compiler warning when doing that ?
-
Thanks for your response. No i did not recognize any error while compiling.
Well my development environment is: Windows PC with a virtual machine running ubuntu. The target is a raspberry. So its a cross-environment. Perhaps this is the reason?
BTW, it tooks a very long time to build this environment with all drivers for sql, touch etc. Especially the touch in combination with eglfs was very hard (one need tslib from other sources etc.) -
Not an error, a warning.
Embedded development is rarely a piece of cake ;)