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. How to connect to an SQL server using Windows authentication using qt?

How to connect to an SQL server using Windows authentication using qt?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 275 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.
  • M Offline
    M Offline
    Mounish
    wrote on 23 Sept 2020, 08:24 last edited by
    #1

    Hi, As of now i am using the below part of code to connect to SQL server. But I need to connect to SQL server using Windows authentication. Kindly help me out to connect SQL server using Windows authentication.

    Here is the code, its working fine and able to connect the SQL server using SQL server Authentication:
    dbase.setDatabaseName(QString("DRIVER={SQL Server};"
    "Server=%1;"
    "Database=%2;"
    "Uid="+cipher.username()+"
    "Pwd="+cipher.password()+")").arg(dbserver).arg(dbname));

    Thanks in advance!

    J 1 Reply Last reply 23 Sept 2020, 08:34
    0
    • M Mounish
      23 Sept 2020, 08:24

      Hi, As of now i am using the below part of code to connect to SQL server. But I need to connect to SQL server using Windows authentication. Kindly help me out to connect SQL server using Windows authentication.

      Here is the code, its working fine and able to connect the SQL server using SQL server Authentication:
      dbase.setDatabaseName(QString("DRIVER={SQL Server};"
      "Server=%1;"
      "Database=%2;"
      "Uid="+cipher.username()+"
      "Pwd="+cipher.password()+")").arg(dbserver).arg(dbname));

      Thanks in advance!

      J Offline
      J Offline
      JonB
      wrote on 23 Sept 2020, 08:34 last edited by
      #2

      @Mounish
      Is the driver string you show for Microsoft SQL Server? (If so, I hadn't heard of Uid= or Pwd=, but there you are.) Whatever it is for, what does that database driver documentation say is the syntax for using Win Auth?

      1 Reply Last reply
      0

      2/2

      23 Sept 2020, 08:34

      • Login

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