Qt MSSql connection returns Login failed for user 'xxx'



  • I tried to connect MSSql database wit Qt 4.8.6. I wrote this:

    db = QSqlDatabase::addDatabase("QODBC3");
    db.setDatabaseName("DRIVER={SQL SERVER};SERVER=x.x.x.x;Port=1433#;DATABASE=aaa;User_id=bbb;Password=ccc;");
    

    It returns QSqlError(0, "QODBC3: Unable to connect", "[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.

    I can connect the database with DBeaver and odbcad32.exe
    How can I connect with Qt ?
    I use Qt 4.8.6 with MinGW 4.8.2 on Windows 7



  • Hi, try adding Integrated Security=false; to your connection string, e.g.:
    "DRIVER={SQL SERVER};SERVER=x.x.x.x;Port=1433#;DATABASE=aaa;Integrated Security=false;User_id=bbb;Password=ccc;


Log in to reply
 

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