I tried new connection via:
$conn = new PDO("sqlsrv:server=SERVERNAME;database=DBNAME;MultipleActiveResultSets=false", "username", "password");
and it did not work, however when I remove the username and password it works fine.
username is the same as my windows login, I tried multiple combinations as DOMAIN\username or username@domain.com etc, nothing works. However when username and password are not present, then it connects fine.
The error is:
SQLSTATE[28000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Login failed for user 'username'.
so to my question, in order to debug the problem. Is it possible to check what username is used when automatic authentication is used after the login succeed?
EDIT: so once upon login without username and pass i tried:
Select name FROM DBNAME.sys.syslogins
and it gave me "DOMAIN\USERNAME"
I have tried that several times even before, but still same error :(
EDIT2: is it in db loginlist authorization? I have tried SQL Studio to log in via Windows authentication - works fine, however when i sqich to SQL server authentication and use the correct username and password, it gives me same error again, like the username is not existing anymore...