Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Problem to insert data in phpmyadmin using qt:



  • Hello, I have a problem to insert data in a data base (phpmyadmin) using qt, after compiling I don't have errors but the elements I want to add doesn't reach the data base.
    Thank you in advance.

    My code :

    void AjouterEtudiant::on_pushButton_AjouterEtud_clicked()
    {
    QSqlDatabase db = QSqlDatabase::database("QSQLITE");
    db.setHostName("localhost:8889");
    db.setDatabaseName("ProjetC++");
    db.setUserName("Oussama");
    db.setPassword("Sokhna");
    db.open();

    QString Nom,Prénom,Num_Etudiant,Date_de_naissance,Num_de_Tél,Adresse;
    Nom=ui->txt_nom->text();
    Prénom=ui->txt_prenom->text();
    Num_Etudiant=ui->txt_Netud->text();
    Date_de_naissance =ui->txt_Datenaiss->text();
    Num_de_Tél=ui->txt_NTel->text();
    Adresse=ui->txt_Adresse->text();
    
    QSqlQuery qry(db);
    QString Etudiant;
    
    
    if(db.open()){
    
    qry.prepare("INSERT INTO Etudiant (Nom,Prénom,Num_Etudiant,Date_de_naissance,Num_de_Tél,Adresse)"
                "VALUES (:newNom,:newPrénom,:newNum_Etudiant,:newDate_de_naissance,:newNum_de_Tél,:newAdresse)");
    qry.bindValue(":newNom",Nom);
    qry.bindValue(":newPrénom",Prénom);
    qry.bindValue(":newNum_Etudiant",Num_Etudiant);
    qry.bindValue(":newDate_de_naissance",Date_de_naissance);
    qry.bindValue(":newNum_de_Tél",Num_de_Tél);
    qry.bindValue(":newAdresse",Adresse);
    qry.exec();
    

    if(qry.exec()){

    QMessageBox::information(this,"Reussite","Le nouveau étudiant a été ajouté avec succès");
    db.close();
    this->close();
    

    }else
    {
    QMessageBox::critical(this,"Erreur","Erreur lors de l'ajout de l'étudiant");
    }
    }
    }



  • @Hiouas Do you want to dialog with a SQLite Database or mySQL Database?

    This for an SQLite database

    QSqlDatabase db = QSqlDatabase::database("QSQLITE");
    

    For an mySQL database

    QSqlDatabase db = QSqlDatabase::database("QMYSQL");
    

    cf. https://doc.qt.io/qt-5/sql-connecting.html



  • @KroMignon said in Problem to insert data in phpmyadmin using qt::

    https://doc.qt.io/qt-5/sql-connecting.html

    Hello , thank you for replying. I don't know the difference between QSQLITE and QMYSQL, but if I work with QMYSQL it generates errors when I compile .
    This are the errors :
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7.
    PS: I am using a MAC.



  • @Hiouas QSQLite is to work with SQLite Databases (cf. www.sqlite.org), QMYSQL is to work with mySQL / MariaDB Databases (cf. www.mysql.org / www.mariadb.org).

    So first is to know what is your database backend!
    But, if you are using phpMyAdmin, I supposed this is mySQL. Just to be complet, phpMyAdmin is NOT a database, it is a tool (writen in PHP) to help managing a mySQL Database.

    If you are using mySQL, you have to install corresponding "connector" libraries, a rapid search on google (I don't have a Mac), tells me:

    brew install mysql-connector-c
    

    Will do the job.



  • Hello I am using mySQL, I tried to execute the line but it says : -bash: brew: command not found.
    Thank you .



  • @Hiouas sorry, can't help more. You have to install mysql connectors. As I written before, I don't have a Mac. But I think Google could help you.



  • Thank you very much, I already installed MAMP.





  • I installed the package, but the same problem :/.



  • @Hiouas Try to start your application with environment variable QT_DEBUG_PLUGINGS=1 to see why mySQL Plugin could not be loaded.



  • @KroMignon please where to put the line QT_DEBUG_PLUGINGS=1?



  • You can set as enviroment variable before starting your application, or you can modifiy your main.cpp to force value

    Sorry, I've made an error ==> QT_DEBUG_PLUGINS not QT_DEBUG_PLUGINGS

    int main(int argc, char *argv[])
    {
        qputenv("QT_DEBUG_PLUGINS", "1");
    ...
    }
    


  • @KroMignon said in Problem to insert data in phpmyadmin using qt::

    qputenv("QT_DEBUG_PLUGINS", "1");

    It generates this :

    QFactoryLoader::QFactoryLoader() checking directory path "/Applications/5.7/clang_64/plugins/platforms" ...
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/platforms/libqcocoa.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/platforms/libqcocoa.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "cocoa"
    ]
    },
    "className": "QCocoaIntegrationPlugin",
    "debug": false,
    "version": 329472
    }

    Got keys from plugin meta data ("cocoa")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/platforms/libqminimal.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/platforms/libqminimal.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "minimal"
    ]
    },
    "className": "QMinimalIntegrationPlugin",
    "debug": false,
    "version": 329472
    }

    Got keys from plugin meta data ("minimal")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/platforms/libqminimal_debug.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/platforms/libqminimal_debug.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "minimal"
    ]
    },
    "className": "QMinimalIntegrationPlugin",
    "debug": true,
    "version": 329472
    }

    Got keys from plugin meta data ("minimal")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/platforms/libqoffscreen.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/platforms/libqoffscreen.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "offscreen"
    ]
    },
    "className": "QOffscreenIntegrationPlugin",
    "debug": false,
    "version": 329472
    }

    Got keys from plugin meta data ("offscreen")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/platforms/libqoffscreen_debug.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/platforms/libqoffscreen_debug.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
    "Keys": [
    "offscreen"
    ]
    },
    "className": "QOffscreenIntegrationPlugin",
    "debug": true,
    "version": 329472
    }

    Got keys from plugin meta data ("offscreen")
    QFactoryLoader::QFactoryLoader() checking directory path "/Users/Oussama/build-Projet1-Desktop_Qt_5_7_0_clang_64bit-Debug/Projet1.app/Contents/MacOS/platforms" ...
    loaded library "/Applications/5.7/clang_64/plugins/platforms/libqcocoa.dylib"
    QFactoryLoader::QFactoryLoader() checking directory path "/Applications/5.7/clang_64/plugins/platformthemes" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/Users/Oussama/build-Projet1-Desktop_Qt_5_7_0_clang_64bit-Debug/Projet1.app/Contents/MacOS/platformthemes" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/Applications/5.7/clang_64/plugins/styles" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/Users/Oussama/build-Projet1-Desktop_Qt_5_7_0_clang_64bit-Debug/Projet1.app/Contents/MacOS/styles" ...
    loaded library "/System/Library/Frameworks/Carbon.framework/Carbon"
    QFactoryLoader::QFactoryLoader() checking directory path "/Applications/5.7/clang_64/plugins/imageformats" ...
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/imageformats/libqdds.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/imageformats/libqdds.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
    "Keys": [
    "dds"
    ],
    "MimeTypes": [
    "image/x-dds"
    ]
    },
    "className": "QDDSPlugin",
    "debug": false,
    "version": 329472
    }

    Got keys from plugin meta data ("dds")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/imageformats/libqdds_debug.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/imageformats/libqdds_debug.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
    "Keys": [
    "dds"
    ],
    "MimeTypes": [
    "image/x-dds"
    ]
    },
    "className": "QDDSPlugin",
    "debug": true,
    "version": 329472
    }

    Got keys from plugin meta data ("dds")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/imageformats/libqgif.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/imageformats/libqgif.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
    "Keys": [
    "gif"
    ],
    "MimeTypes": [
    "image/gif"
    ]
    },
    "className": "QGifPlugin",
    "debug": false,
    "version": 329472
    }

    Got keys from plugin meta data ("gif")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/imageformats/libqgif_debug.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/imageformats/libqgif_debug.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
    "Keys": [
    "gif"
    ],
    "MimeTypes": [
    "image/gif"
    ]
    },
    "className": "QGifPlugin",
    "debug": true,
    "version": 329472
    }

    Got keys from plugin meta data ("gif")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/imageformats/libqicns.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/imageformats/libqicns.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
    "Keys": [
    "icns"
    ],
    "MimeTypes": [
    "image/x-icns"
    ]
    },
    "className": "QICNSPlugin",
    "debug": false,
    "version": 329472
    }

    Got keys from plugin meta data ("icns")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/imageformats/libqicns_debug.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/imageformats/libqicns_debug.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
    "Keys": [
    "icns"
    ],
    "MimeTypes": [
    "image/x-icns"
    ]
    },
    "className": "QICNSPlugin",
    "debug": true,
    "version": 329472
    }

    Got keys from plugin meta data ("icns")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/imageformats/libqico.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/imageformats/libqico.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
    "Keys": [
    "ico",
    "cur"
    ],
    "MimeTypes": [
    "image/vnd.microsoft.icon"
    ]
    },
    "className": "QICOPlugin",
    "debug": false,
    "version": 329472
    }

    Got keys from plugin meta data ("ico", "cur")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/imageformats/libqico_debug.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/imageformats/libqico_debug.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
    "Keys": [
    "ico",
    "cur"
    ],
    "MimeTypes": [
    "image/vnd.microsoft.icon"
    ]
    },
    "className": "QICOPlugin",
    "debug": true,
    "version": 329472
    }

    Got keys from plugin meta data ("ico", "cur")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/imageformats/libqjpeg.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/imageformats/libqjpeg.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
    "Keys": [
    "jpg",
    "jpeg"
    ],
    "MimeTypes": [
    "image/jpeg",
    "image/jpeg"
    ]
    },
    "className": "QJpegPlugin",
    "debug": false,
    "version": 329472
    }

    Got keys from plugin meta data ("jpg", "jpeg")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/imageformats/libqjpeg_debug.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/imageformats/libqjpeg_debug.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
    "Keys": [
    "jpg",
    "jpeg"
    ],
    "MimeTypes": [
    "image/jpeg",
    "image/jpeg"
    ]
    },
    "className": "QJpegPlugin",
    "debug": true,
    "version": 329472
    }

    Got keys from plugin meta data ("jpg", "jpeg")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/imageformats/libqmacjp2.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/imageformats/libqmacjp2.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
    "Keys": [
    "jp2"
    ],
    "MimeTypes": [
    "image/jp2",
    "image/jpx",
    "image/jpm",
    "video/mj2"
    ]
    },
    "className": "QMacJp2Plugin",
    "debug": false,
    "version": 329472
    }

    Got keys from plugin meta data ("jp2")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/imageformats/libqmacjp2_debug.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/imageformats/libqmacjp2_debug.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
    "Keys": [
    "jp2"
    ],
    "MimeTypes": [
    "image/jp2",
    "image/jpx",
    "image/jpm",
    "video/mj2"
    ]
    },
    "className": "QMacJp2Plugin",
    "debug": true,
    "version": 329472
    }

    Got keys from plugin meta data ("jp2")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/imageformats/libqsvg.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/imageformats/libqsvg.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
    "Keys": [
    "svg",
    "svgz"
    ],
    "MimeTypes": [
    "image/svg+xml"
    ]
    },
    "className": "QSvgPlugin",
    "debug": false,
    "version": 329472
    }

    Got keys from plugin meta data ("svg", "svgz")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/imageformats/libqsvg_debug.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/imageformats/libqsvg_debug.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
    "Keys": [
    "svg",
    "svgz"
    ],
    "MimeTypes": [
    "image/svg+xml"
    ]
    },
    "className": "QSvgPlugin",
    "debug": true,
    "version": 329472
    }

    Got keys from plugin meta data ("svg", "svgz")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/imageformats/libqtga.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/imageformats/libqtga.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
    "Keys": [
    "tga"
    ],
    "MimeTypes": [
    "image/x-tga"
    ]
    },
    "className": "QTgaPlugin",
    "debug": false,
    "version": 329472
    }

    Got keys from plugin meta data ("tga")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/imageformats/libqtga_debug.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/imageformats/libqtga_debug.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
    "Keys": [
    "tga"
    ],
    "MimeTypes": [
    "image/x-tga"
    ]
    },
    "className": "QTgaPlugin",
    "debug": true,
    "version": 329472
    }

    Got keys from plugin meta data ("tga")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/imageformats/libqtiff.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/imageformats/libqtiff.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
    "Keys": [
    "tiff",
    "tif"
    ],
    "MimeTypes": [
    "image/tiff",
    "image/tiff"
    ]
    },
    "className": "QTiffPlugin",
    "debug": false,
    "version": 329472
    }

    Got keys from plugin meta data ("tiff", "tif")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/imageformats/libqtiff_debug.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/imageformats/libqtiff_debug.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
    "Keys": [
    "tiff",
    "tif"
    ],
    "MimeTypes": [
    "image/tiff",
    "image/tiff"
    ]
    },
    "className": "QTiffPlugin",
    "debug": true,
    "version": 329472
    }

    Got keys from plugin meta data ("tiff", "tif")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/imageformats/libqwbmp.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/imageformats/libqwbmp.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
    "Keys": [
    "wbmp"
    ],
    "MimeTypes": [
    "image/vnd.wap.wbmp"
    ]
    },
    "className": "QWbmpPlugin",
    "debug": false,
    "version": 329472
    }

    Got keys from plugin meta data ("wbmp")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/imageformats/libqwbmp_debug.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/imageformats/libqwbmp_debug.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
    "Keys": [
    "wbmp"
    ],
    "MimeTypes": [
    "image/vnd.wap.wbmp"
    ]
    },
    "className": "QWbmpPlugin",
    "debug": true,
    "version": 329472
    }

    Got keys from plugin meta data ("wbmp")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/imageformats/libqwebp.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/imageformats/libqwebp.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
    "Keys": [
    "webp"
    ],
    "MimeTypes": [
    "image/webp"
    ]
    },
    "className": "QWebpPlugin",
    "debug": false,
    "version": 329472
    }

    Got keys from plugin meta data ("webp")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/imageformats/libqwebp_debug.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/imageformats/libqwebp_debug.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
    "MetaData": {
    "Keys": [
    "webp"
    ],
    "MimeTypes": [
    "image/webp"
    ]
    },
    "className": "QWebpPlugin",
    "debug": true,
    "version": 329472
    }

    Got keys from plugin meta data ("webp")
    QFactoryLoader::QFactoryLoader() checking directory path "/Users/Oussama/build-Projet1-Desktop_Qt_5_7_0_clang_64bit-Debug/Projet1.app/Contents/MacOS/imageformats" ...
    loaded library "/Applications/5.7/clang_64/plugins/imageformats/libqdds.dylib"
    loaded library "/Applications/5.7/clang_64/plugins/imageformats/libqgif.dylib"
    loaded library "/Applications/5.7/clang_64/plugins/imageformats/libqicns.dylib"
    loaded library "/Applications/5.7/clang_64/plugins/imageformats/libqico.dylib"
    loaded library "/Applications/5.7/clang_64/plugins/imageformats/libqjpeg.dylib"
    loaded library "/Applications/5.7/clang_64/plugins/imageformats/libqmacjp2.dylib"
    loaded library "/Applications/5.7/clang_64/plugins/imageformats/libqsvg.dylib"
    loaded library "/Applications/5.7/clang_64/plugins/imageformats/libqtga.dylib"
    loaded library "/Applications/5.7/clang_64/plugins/imageformats/libqtiff.dylib"
    loaded library "/Applications/5.7/clang_64/plugins/imageformats/libqwbmp.dylib"
    loaded library "/Applications/5.7/clang_64/plugins/imageformats/libqwebp.dylib"
    QFactoryLoader::QFactoryLoader() checking directory path "/Applications/5.7/clang_64/plugins/accessible" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/Users/Oussama/build-Projet1-Desktop_Qt_5_7_0_clang_64bit-Debug/Projet1.app/Contents/MacOS/accessible" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/Applications/5.7/clang_64/plugins/sqldrivers" ...
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/sqldrivers/libmysqlclient.20.dylib"
    QMachOParser: '/Applications/5.7/clang_64/plugins/sqldrivers/libmysqlclient.20.dylib' is not a Qt plugin
    "'/Applications/5.7/clang_64/plugins/sqldrivers/libmysqlclient.20.dylib' is not a Qt plugin"
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/sqldrivers/libmysqlclient.dylib"
    QMachOParser: '/Applications/5.7/clang_64/plugins/sqldrivers/libmysqlclient.20.dylib' is not a Qt plugin
    "'/Applications/5.7/clang_64/plugins/sqldrivers/libmysqlclient.20.dylib' is not a Qt plugin"
    not a plugin
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/sqldrivers/libqsqlite.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/sqldrivers/libqsqlite.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
    "MetaData": {
    "Keys": [
    "QSQLITE"
    ]
    },
    "className": "QSQLiteDriverPlugin",
    "debug": false,
    "version": 329472
    }

    Got keys from plugin meta data ("QSQLITE")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/sqldrivers/libqsqlite_debug.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/sqldrivers/libqsqlite_debug.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
    "MetaData": {
    "Keys": [
    "QSQLITE"
    ]
    },
    "className": "QSQLiteDriverPlugin",
    "debug": true,
    "version": 329472
    }

    Got keys from plugin meta data ("QSQLITE")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/sqldrivers/libqsqlmysql.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/sqldrivers/libqsqlmysql.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
    "MetaData": {
    "Keys": [
    "QMYSQL3",
    "QMYSQL"
    ]
    },
    "className": "QMYSQLDriverPlugin",
    "debug": false,
    "version": 329472
    }

    Got keys from plugin meta data ("QMYSQL3", "QMYSQL")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/sqldrivers/libqsqlmysql_debug.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/sqldrivers/libqsqlmysql_debug.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
    "MetaData": {
    "Keys": [
    "QMYSQL3",
    "QMYSQL"
    ]
    },
    "className": "QMYSQLDriverPlugin",
    "debug": true,
    "version": 329472
    }

    Got keys from plugin meta data ("QMYSQL3", "QMYSQL")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/sqldrivers/libqsqlodbc.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/sqldrivers/libqsqlodbc.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
    "MetaData": {
    "Keys": [
    "QODBC3",
    "QODBC"
    ]
    },
    "className": "QODBCDriverPlugin",
    "debug": false,
    "version": 329472
    }

    Got keys from plugin meta data ("QODBC3", "QODBC")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/sqldrivers/libqsqlodbc_debug.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/sqldrivers/libqsqlodbc_debug.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
    "MetaData": {
    "Keys": [
    "QODBC3",
    "QODBC"
    ]
    },
    "className": "QODBCDriverPlugin",
    "debug": true,
    "version": 329472
    }

    Got keys from plugin meta data ("QODBC3", "QODBC")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/sqldrivers/libqsqlpsql.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/sqldrivers/libqsqlpsql.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
    "MetaData": {
    "Keys": [
    "QPSQL7",
    "QPSQL"
    ]
    },
    "className": "QPSQLDriverPlugin",
    "debug": false,
    "version": 329472
    }

    Got keys from plugin meta data ("QPSQL7", "QPSQL")
    QFactoryLoader::QFactoryLoader() looking at "/Applications/5.7/clang_64/plugins/sqldrivers/libqsqlpsql_debug.dylib"
    Found metadata in lib /Applications/5.7/clang_64/plugins/sqldrivers/libqsqlpsql_debug.dylib, metadata=
    {
    "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
    "MetaData": {
    "Keys": [
    "QPSQL7",
    "QPSQL"
    ]
    },
    "className": "QPSQLDriverPlugin",
    "debug": true,
    "version": 329472
    }

    Got keys from plugin meta data ("QPSQL7", "QPSQL")
    QFactoryLoader::QFactoryLoader() checking directory path "/Users/Oussama/build-Projet1-Desktop_Qt_5_7_0_clang_64bit-Debug/Projet1.app/Contents/MacOS/sqldrivers" ...
    loaded library "/Applications/5.7/clang_64/plugins/sqldrivers/libqsqlmysql.dylib"
    QLibraryPrivate::loadPlugin failed on "/Applications/5.7/clang_64/plugins/sqldrivers/libqsqlmysql.dylib" : "Cannot load library /Applications/5.7/clang_64/plugins/sqldrivers/libqsqlmysql.dylib: (dlopen(/Applications/5.7/clang_64/plugins/sqldrivers/libqsqlmysql.dylib, 5): Library not loaded: /opt/local/lib/mysql55/mysql/libmysqlclient.18.dylib\n Referenced from: /Applications/5.7/clang_64/plugins/sqldrivers/libqsqlmysql.dylib\n Reason: image not found)"
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
    La connexion a échoué



  • I have solved the problem by installing homebrew and execute the line :
    brew install mysql-connector-c.


Log in to reply