Using a TAdoConnection in D5 to connect to a local Sql Server on a Windows 7 64-bit machine using a passworded sa account, I get the error "login failed for user sa", despite the fact that I've built the TAdoConnection ConnectionString to include the password. By the time the BeforeConnect event triggers, the ConnectionString no longer contains the password. I can set the password in the WillConnect event and the connection then works fine.
My question is, what's removing the password from the ConnectionString? Is it maybe some security feature added in W7 - I don't recall getting this problem on XP.
Btw: This problem still happens even if I set Persist Security Info to true in the ConnectionString - the password doesn't even get stored in the DFM.
Your ConnectionString needs to include "Persist Security Info=True" see this prior topic. I use two const, one for SQL Authentication and the other for Active Directory Authentication and just fill in the blanks.
const
csCONNECTION = 'Provider=%s;Password=%s;Persist Security Info=True;User ID=%s;Initial Catalog=%s;Data Source=%s';
csADCONNECTION = 'Provider=%s;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=%s;Data Source=%s';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With