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. Qt MSSql connection returns Login failed for user 'xxx'
Qt 6.11 is out! See what's new in the release blog

Qt MSSql connection returns Login failed for user 'xxx'

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.5k 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.
  • I Offline
    I Offline
    iskenderoguz
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • hskoglundH Offline
      hskoglundH Offline
      hskoglund
      wrote on last edited by
      #2

      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;

      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