Results 1 to 8 of 8

Thread: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

  1. #1
    Join Date
    May 2009
    Posts
    28
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows

    Default MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    Hi all.
    I am trying to connect Mysql with QT on Window XP.
    I made steps:
    1. Installed QT SDK
    2. Installed MySQL
    3. I run Qt Command Prompt to Build the QMYSQL Plugin on Windows.

    cd %QTDIR%\src\plugins\sqldrivers\mysql
    qmake "INCLUDEPATH+=C:\mysql\include" "LIBS+=C:\mysql\lib\opt\libmysql.lib" mysql.pro
    make

    It occurs to me a message :

    ...
    C:/Qt/2009.02/qt/src/plugins/sqldrivers/mysql/../../../sql/drivers/mysql/qsql_my
    sql.cpp:1419: undefined reference to `mysql_real_escape_string@16'
    collect2: ld returned 1 exit status
    make[1]: *** [debug\qsqlmysqld4.dll] Error 1
    make[1]: Leaving directory `C:/Qt/2009.02/qt/src/plugins/sqldrivers/mysql'
    make: *** [debug] Error 2
    What happends with me. Please help me.
    Thanks.
    Diego.
    Last edited by diego; 2nd June 2009 at 02:01.

  2. #2
    Join Date
    Jul 2006
    Location
    Atlanta, GA
    Posts
    86
    Thanks
    26
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    Did you run the reimpl command successfully? That is most likely the problem. Follow the directions here to a T.
    fnmblot
    --------------------------------------
    Gee Ricky, I'm sorry your mom blew up.

  3. #3
    Join Date
    May 2009
    Posts
    28
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    Thanks.

    I will try to make it now.
    Last edited by diego; 4th June 2009 at 03:06.

  4. #4
    Join Date
    May 2009
    Posts
    28
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    Quote Originally Posted by fnmblot View Post
    Did you run the reimpl command successfully? That is most likely the problem. Follow the directions here to a T.
    Hi all.

    I am trying to connect mysql with QT on window xp system.

    I made step:

    1. Installed mysql
    2. Installed QT SDK
    3. I copied mingw-utils-0.3 to %QTDIR%/bin)
    4. I did

    1. Open a Qt Command Prompt and go to : C:\mysql\lib\opt
    2. Run : dlltool -k --input-def libmysql.def --dllname libmysql.dll --output-lib C:\Qt\2009.02\mingw\lib\libmysql.a
    3. reimp libmysql.lib to produce the liblibmysql.a file. It had done.
    4. Go to %QTDIR%/src/plugins/sqldrivers/mysql
    5. Run the following command: qmake -o Makefile "INCLUDEPATH+=C:\mysql\include" "LIBS+=C:\mysql\lib\opt\liblibmysql.a" mysql.pro
    6. Run make - this should build the qsqlmysql.dll and libqsqlmysql.a files in the %QTDIR%/plugins/sqldrivers directory.
    7. Copy the libmysql.dll file from the MySQL installation's bin directory to a directory in %PATH% (e.g. %QTDIR%/bin).
    I made i simple QT connecttion

    QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    db.setHostName("209.59.209.13");
    db.setDatabaseName("test");
    db.setUserName("tara");
    db.setPassword("d5aquExV");
    it still has a wrong message
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC
    Please help me. What step i was wrong or what happends to me.
    Thanks in advance.
    Diego

  5. #5
    Join Date
    Jul 2006
    Location
    Atlanta, GA
    Posts
    86
    Thanks
    26
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    Now that you have made the plugin, you have to update the .pro file with QT += sql
    fnmblot
    --------------------------------------
    Gee Ricky, I'm sorry your mom blew up.

  6. #6
    Join Date
    May 2009
    Posts
    28
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    After making pluin. I made 3 simple files for my example
    But now it sitll dont run.
    Please help me discover this problem

    B.Pro file (Project name is B):
    QT += sql
    TARGET = B
    TEMPLATE = app
    SOURCES += main.cpp\
    mainwindow.cpp
    HEADERS += mainwindow.h
    FORMS += mainwindow.ui

    main.cpp :

    #include <QtGui/QApplication>
    #include "mainwindow.h"
    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    return a.exec();
    }

    MainWindow.cpp

    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <QtSql>
    MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    createConnection();
    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }
    void MainWindow::createConnection()
    {
    QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    db.setHostName("127.0.0.13");
    db.setDatabaseName("ytr");
    db.setUserName("root");
    db.setPassword("d5aquE");
    }
    It still appears a message to me that:
    QMYSQL driver not loaded
    Thanks so much.
    Last edited by diego; 8th June 2009 at 08:04.

  7. #7
    Join Date
    Oct 2006
    Location
    Hawaii
    Posts
    130
    Thanks
    48
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    is the qsqlmysqld4.dll in a path that your compiled program is looking for? for example, try making a "sqldrivers" folder within the folder that your compiled EXE is in, and place the "qsqlmysql4.dll" in that folder and see what happens.

  8. #8
    Join Date
    Aug 2009
    Location
    Rio de Janeiro, Brasil
    Posts
    2
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: MySQL driver - Very strange problem. PLEASE HELP ME. Thanks.

    Hi all,

    I was using the link http://wiki.qtcentre.org/index.php?t...ws_using_MinGW and also received the message:

    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC
    Now able to put the files qsqlmysqld4.dll and libqsqlmysqld4.a in

    C:\Qt\2009.03\qt\plugins\sqldrivers
    I have not done a detailed test, but the driver was loaded.

    Thanks

Similar Threads

  1. Replies: 4
    Last Post: 10th November 2009, 19:48
  2. A strange problem with QGraphicsSvgItem
    By Justin_W in forum Qt Programming
    Replies: 6
    Last Post: 23rd July 2008, 09:40
  3. My Mysql 5 and Qt 4.2.2 Problem (Driver not loaded)
    By fengtian.we in forum Qt Programming
    Replies: 4
    Last Post: 9th February 2007, 08:11
  4. MySql plugin driver issues
    By stevey in forum Installation and Deployment
    Replies: 11
    Last Post: 20th September 2006, 13:45

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.