32-bit version of qmysql cant connect to server



  • 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;
    }@



  • 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.



  • 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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.