Hello,
PowerBuilder 2019
Sql Server 2019
Is there a way to authenticate a AD account that's not the current windows user with SQL Server?
For instance
John Doe is logged into windows
Jane Doe logs into the app
We need Jane Doe Authenticating not John Doe
This is my code so far
App.ini
DBParm = "ConnectString='DSN=SERVER',ConnectOption='SQL_INTEGRATED_SECURITY,SQL_IS_ON', MsgTerse='Yes',DisableBind=1,DelimitIdentifier='No'"
External functions
Function boolean LogonUser ( string lpszUsername, string lpszDomain, string lpszPassword, ulong dwLogonType, ulong dwLogonProvider, ref ulong phToken) Library "advapi32.dll" Alias For "LogonUserW"
Function boolean CloseHandle (ulong hObject) Library "kernel32.dll"
PowerScript
lb_result = LogonUser( as_uid, ls_domain, as_pwd, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, lul_token )
When I try to connect as Jane Doe it seems to work ok but when I look at the connections in the database I'm actually connected as John Doe.
Is there a way to do this?