QGIS icon indicating copy to clipboard operation
QGIS copied to clipboard

MSSQL password is not prompted if pw Save is unchecked

Open robhubi opened this issue 4 years ago • 4 comments

Describe the bug The problem is if I don't check Save Password in the Create a New MSSQL connection dialog (what you get after hitting New or Edit in the Data Source Manager / MSSQL dialog) in QGIS when setting up a connection then QGIS loses the password as soon as the window is closed. The following connection attempts fail. If Save password is checked, everything works as expected.

How to Reproduce Prerequisites: Credentials for MSSQL Server

  1. Start QGIS – New Empty Project
  2. Open Data Source Manager – click Add MSSQL Layer
  3. Under connections click New
  4. Enter Connection Name, Host, Username and Password
  5. Check Save Username
  6. Uncheck Save Password
  7. Click List Databases --> perfect, your database is now listed
  8. Click OK to close window "Create a New MSSQL Connection"
  9. In "Data Source Manager" window click Connect

Actual Result Error MSSQL Provider [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. [Microsoft][ODBC Driver Manager] Fehler bei SQLSetConnectAttr-Aufruf für Treiber QODBC3: Unable to connect

Expected Result A password prompt and then a list of available MSSQL Tables

QGIS and OS versions

QGIS version 3.16.1-Hannover QGIS code revision b381a90dca
Compiled against Qt 5.11.2 Running against Qt 5.11.2
Compiled against GDAL/OGR 3.1.4 Running against GDAL/OGR 3.1.4
Compiled against GEOS 3.8.1-CAPI-1.13.3 Running against GEOS 3.8.1-CAPI-1.13.3
Compiled against SQLite 3.29.0 Running against SQLite 3.29.0
PostgreSQL Client Version 11.5 SpatiaLite Version 4.3.0
QWT Version 6.1.3 QScintilla2 Version 2.10.8
Compiled against PROJ 6.3.2 Running against PROJ Rel. 6.3.2, May 1st, 2020
OS Version Windows 10 (10.0)
Active python plugins QuickOSM; quick_map_services; db_manager; MetaSearch; processing

Additional context


robhubi avatar Dec 20 '20 23:12 robhubi

@robhubi Hello, is this issue still valid on recent releases?

Pedro-Murteira avatar Apr 19 '22 13:04 Pedro-Murteira

Hi Pedro-Murteira, The current LTR version QGIS 3.22.6-Białowieża, code rev. b6f33b1a behaves a bit differently, so after "Connect" the objects of the database are listed, but always remain greyed out with type "Detecting...". After clicking on "Also list tables with no geometry" the above error occurs.

So yes, the current QGIS version shows the same issue.

robhubi avatar Apr 24 '22 09:04 robhubi

Hi, We have the same issue. The only way to use a MSSQL connection in QGIS in a user-friendly way is by saving the password as plain text, which is not safe. Is there a way to provide the same functionalities (the password prompt) as the postgres connection has for the mssql connection?

We 're using qgis 3.28.12

franbroekmansfiberklaar avatar May 06 '24 08:05 franbroekmansfiberklaar

Or is there an option to use the pasword manager in the MSSQL Connection?

franbroekmansfiberklaar avatar May 07 '24 13:05 franbroekmansfiberklaar