Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt5 MySQL crash on opening database
Forum Updated to NodeBB v4.3 + New Features

Qt5 MySQL crash on opening database

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    soroush
    wrote on last edited by
    #1

    Hi there

    I'm using Qt 5.0.0 on Windows 7 x64 (personal compile - MinGW x64). I added MySQL support in configuration and also MySQL is installed on system. MySQL libraries, headers and are visible in application.

    Program crashes on opening database. I open database like this:
    @
    QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    db.setDatabaseName("My DB name");
    db.setUserName("root");
    db.setPassword("My password");
    db.setHostName("localhost");
    db.setPort(3306);
    @

    Notes:
    @
    qDebug() << QSqlDatabase::drivers();
    @

    prints:

    @
    ("QMYSQL3", "QMYSQL", "QODBC3", "QODBC", "QSQLITE")
    @

    What is difference between QMYSQL3 and QMYSQL ? I tried both and program crashes when opening database.
    AFAIK MySQL driver is compiled with MSVC. I'm using MinGW. Can this be related to binary incompatibility ?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      soroush
      wrote on last edited by
      #2

      Update:

      Problem signature:

      Problem Event Name: APPCRASH
      Application Name: CMS.exe
      Application Version: 0.0.0.0
      Application Timestamp: 51010cdd
      Fault Module Name: Qt5Sql.dll
      Fault Module Version: 5.0.0.0
      Fault Module Timestamp: 50f6b734
      Exception Code: c0000005
      Exception Offset: 00000000000df950
      OS Version: 6.1.7600.2.0.0.256.1
      Locale ID: 1033
      Additional Information 1: db69
      Additional Information 2: db697f824a06df6631cf05ed1f197e16
      Additional Information 3: 1d76
      Additional Information 4: 1d7605bf295c1c2cfcbfc6bfcec7c569

      I generate .a file using gendef and dlltool :
      @
      gendef libmysql.dll
      dlltool --input-def libmysql.def --dllname libmysql.dll --output-lib libmysql.a
      @
      And add a link to libmysql in my .pro file.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mohsen
        wrote on last edited by
        #3

        hey soroush, does this problem exists on 32 bit version too? i've recently tried with 32bit mingw/Qt and that was same issue. the message indicates that mysql driver is not loaded while then lists mysql as an available driver.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          soroush
          wrote on last edited by
          #4

          [quote author="Mohsen" date="1359974901"]hey soroush, does this problem exists on 32 bit version too? i've recently tried with 32bit mingw/Qt and that was same issue. the message indicates that mysql driver is not loaded while then lists mysql as an available driver.[/quote]

          I'm going to test it tonight

          Update: Just tested. Works fine for 32bit MySQL. 64 bit is still problematic. I guess it could be a matter of none-standard code in Qt code which cause an optimization pitfall. The -O3 optimization level is known as dangerous for some architectures. I'm going to test a new compile with no optimization in 64 bit machine tonight

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved