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. 32-bit version of qmysql cant connect to server
QtWS25 Last Chance

32-bit version of qmysql cant connect to server

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.1k Views
  • 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
    Strandmatte
    wrote on last edited by
    #1

    Hello,
    I'm developing a Qt-desktop application with a MySQL-Server in the background.

    When I build the App with 64-bit configuration everything works fine, but when I do it in 32-bit mode I get the following Error:

    "Can't connect to MySQL server on 'localhost' (10061) QMYSQL: Unable to connect"

    As said above, in 64-bit the connection is established without any problems...

    I have both (32- and 64-bit) versions of libmysql.dll on my computer and made sure to link the correct one.

    I'm a little bit stuck here...so please help me :)

    Here's my code by the way:

    This works fine in both versions:
    @dbConnection::dbConnection(){

    //Datenbanktreiber setzen = MySQL
    db = QSqlDatabase::addDatabase("QMYSQL");
    opened = false;
    }@

    And here is the problem:
    @bool dbConnection::connect(QString hostName,int port,QString Sheme, QString userName,QString password){
    if (opened) db.close();
    //Anmeldedaten
    db.setHostName(hostName);
    db.setDatabaseName(Sheme);
    db.setPort(port);
    db.setPassword(password);
    db.setUserName(userName);

    //Datenbank öffnen
    opened = db.open();

    return opened;
    }@

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      Hi,

      how did you built 32 and 64 bit version? what compiler? what Qt version?

      You should have separate Qt installation for 32 and 64 bit.

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Strandmatte
        wrote on last edited by
        #3

        Hey,

        I built 32 bit version with visual studio native command prompt for x86
        and the 64 bit version with visual studio native command prompt for x64.

        The Qt Version is 5.0.2

        The versions were saved in 2 different folders

        And my configuration for the builds was:

        configure -prefix

        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