thecodemonkey86 / qt_mysql_driver

Typical symptom: QMYSQL driver not loaded. Solution: get pre-built Qt SQL driver plug-in required to establish a connection to MySQL / MariaDB using Qt. Download qsqlmysql.dll binaries built from official Qt source code
Other
417 stars 58 forks source link

Driver not loaded error. Are the plugins debug or release plugins? #34

Open ben-hearn-sb opened 1 year ago

ben-hearn-sb commented 1 year ago

Hello!

I had a strange issue with the built plugins for MySql on your page, they worked for a time and then they just stopped for some reason and I have not been able to get them operating again.

I have switched over to PySide6 (6.5.2) and downloaded the latest built plugin (6.5.2) and followed the answer at the bottom on this Stackoverflow page to the letter: https://stackoverflow.com/questions/64056483/unable-to-load-qmysql-driver-on-pyside2

Nothing works... Do you have any suggestion before I move my entire database module over to postgres, psycopg2 and construct the QTable by hand?

This is the output of my launching of the database connection (pretty common for sure but impossible to fix):

QMARIADB
QMYSQL
QSQLITE
QODBC
QPSQL
Failure to open database. Fatal error
<PySide6.QtSql.QSqlError("", "Driver not loaded", "Driver not loaded") at 0x00000254539F6FC0>
thecodemonkey86 commented 1 year ago

Hi, is there any additional output if you set the QT_DEBUG_PLUGINS=1 environment variable that might be helpful? Did you check all dependencies of qsqlmysql.dll by using e.g. https://github.com/lucasg/Dependencies ?

ben-hearn-sb commented 1 year ago

I found your quick fix solution on this issue: https://github.com/thecodemonkey86/qt_mysql_driver/issues/24

This quick fix seems to resolve the drivers not loaded errors. Is there a solution that allows for relative pathing inside a custom package or some such?

I have tried os.environ['PATH'] os.environ['PYTHONPATH'] os.add_dll_directory()

Unfortunately nothing has worked so far :/