Qsqldatabase Qpsql Driver Not Loaded

Posted on  by 

Hi all,

  • QSqlDatabase: QPSQL driver not loaded; qsqldatabase qpsql driver not loaded windows.
  • QSqlDatabase: QPSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QMYSQL QMARIADB QODBC QPSQL Could not create database object While navigating the results in forward-only mode, the handle of QSqlResult may change.

I'm getting crazy with QMYSQL :(. I want to connet to a mysql server through this code (for testing the connection only). Qt version is 5.2.1, while OS is Ubuntu 13.10.

@
#include <QCoreApplication>

#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlError>

#include <QDebug>

Dec 15, 2017 'QSqlDatabase: QPSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7' I already tried to build the driver by my self but there are many things different to the instructions and got a lot of errors. QSqlDatabase: QMYSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7 QSqlQuery::exec: database not open.

Qsqldatabase qpsql driver not loaded windows 7

int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
qDebug() << 'Started';
qDebug() << 'library path ' << a.libraryPaths();

QSqlDatabase: QPSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7 Could not create database object While navigating the results in forward-only mode, the handle of QSqlResult may change.

Loaded

}
@

Qsqldatabase Qpsql Driver Not LoadedNot

I get the following output:

Started
library path ('/home/fabio/Qt/5.2.1/gcc/plugins', '/home/fabio/Tests/Qt/build-TestDatabase-Desktop_Qt_5_2_1_GCC_32bit-Debug')
('QSQLITE', 'QMYSQL', 'QMYSQL3', 'QPSQL', 'QPSQL7')
available = true
db error= 'Driver not loaded'
driver error= 'Driver not loaded'
done= false
Failed to open database

  • db error= 'Driver not loaded'
  • driver error= 'Driver not loaded'
    Terminating

As you can see, driver is not loaded, even if all libs are at the correct places and dependencies are satisfied.

This is the past of the plugin dependencies
fabio@ubuntu:~$ ldd /home/fabio/Qt/5.2.1/gcc/plugins/sqldrivers/libqsqlmysql.so
linux-gate.so.1 => (0xb77de000)
libmysqlclient.so.18 => /usr/lib/i386-linux-gnu/libmysqlclient.so.18 (0xb7492000)
libQt5Sql.so.5 => /home/fabio/Qt/5.2.1/gcc/lib/libQt5Sql.so.5 (0xb7453000)
libQt5Core.so.5 => /home/fabio/Qt/5.2.1/gcc/lib/libQt5Core.so.5 (0xb6f89000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb6ea0000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb6cec000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb6cd2000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb6ccd000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb6cb1000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb6c6e000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb6c51000)
libicui18n.so.51 => /home/fabio/Qt/5.2.1/gcc/lib/libicui18n.so.51 (0xb6a2f000)
libicuuc.so.51 => /home/fabio/Qt/5.2.1/gcc/lib/libicuuc.so.51 (0xb68b6000)
libgthread-2.0.so.0 => /usr/lib/i386-linux-gnu/libgthread-2.0.so.0 (0xb68b2000)
librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb68a9000)
libglib-2.0.so.0 => /lib/i386-linux-gnu/libglib-2.0.so.0 (0xb67a5000)
/lib/ld-linux.so.2 (0xb77df000)
libicudata.so.51 => /home/fabio/Qt/5.2.1/gcc/lib/libicudata.so.51 (0xb525c000)
libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xb521a000)

and, in the turn, the pasting of libmysqlclient which the plugin depends on:

fabio@ubuntu:~$ ldd /usr/lib/i386-linux-gnu/libmysqlclient.so.18
linux-gate.so.1 => (0xb773a000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb73e6000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb73e1000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb73c5000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb7382000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb7365000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb71b1000)
/lib/ld-linux.so.2 (0xb773b000)

To be more precise, I have built the plugin directly from source code (5.2.1) and the database mentioned in the code really exists on 127.0.0.1.

I also tried with QMYSQL3 (same result).

Qsqldatabase Qpsql Driver Not Loaded Windows 7

I really don't know what else to check.
Please help me

Qsqldatabase Qpsql Driver Not Loaded Tool

Thanks in advance
Fabio

Coments are closed