aliimagnito
aliimagnito

Reputation: 65

Inno Setup: Tell ODBC to be authenticated by Windows NT/SQL

Im trying to create a ODBC and it worked, yay. But one thing drives me insane.

Can I tell the code in the [Registry] section to create a ODBC especially with Windows NT authentication OR SQL authentication?

By far, my code to create the ODBC looks like this:

Root: HKCU; SubKey: Software\ODBC\ODBC.INI\ODBC Data Sources; ValueType: string; ValueName: {code:GetWINServerData|2}; ValueData: SQL Server; Flags: createvalueifdoesntexist uninsdeletevalue; Check: GetAuthModeWindows
Root: HKCU; SubKey: Software\ODBC\ODBC.INI\{code:GetWINServerData|2}; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: Driver; ValueType: string; ValueData: {sys}\SQLSRV32.dll; Check: GetAuthModeWindows
Root: HKCU; SubKey: Software\ODBC\ODBC.INI\{code:GetWINServerData|2}; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: Server; ValueType: string; ValueData: {code:GetWINServerData|1}; Check: GetAuthModeWindows
Root: HKCU; SubKey: Software\ODBC\ODBC.INI\{code:GetWINServerData|2}; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: Database; ValueType: string; ValueData: {code:GetWINServerData|0}; Check: GetAuthModeWindows
Root: HKCU; SubKey: Software\ODBC\ODBC.INI\{code:GetWINServerData|2}; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: LastUser; ValueType: string; ValueData: WinUser; Check: GetAuthModeWindows
Root: HKCU; SubKey: Software\ODBC\ODBC.INI\{code:GetWINServerData|2}; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: Password; ValueType: string; ValueData: WinPass; Check: GetAuthModeWindows

This code works, it just creates only ODBC with SQL authentication. Any opinions?

Upvotes: 0

Views: 268

Answers (1)

aliimagnito
aliimagnito

Reputation: 65

I found the answer:

if you want to be your ODBC authenticated by Windows NT, add the Trusted_Connection key like I did:

Root: HKCU; SubKey: Software\ODBC\ODBC.INI\{code:GetWINServerData|2}; Flags: createvalueifdoesntexist uninsdeletevalue; ValueName: Trusted_Connection; ValueType: string; ValueData: Yes; Check: GetAuthModeWindows

The "key" here is the following: If you want to use a Windows authentication, theres an additional key called "Trusted_Connection". If this key has the value "Yes", its defined as windows authenticated. If this key isnt there, its SQL authenticated.

Feel free to correct me, but it works for me here.

I created two different ODBCs. The only difference was the authentication mode. I looked it up in the registry and the only difference there was the "Trusted_Connection" key.

Upvotes: 1

Related Questions