The Way Of Life: Run time Error – 2147217843 Login failed for user 'SA'

Friday, June 14, 2013

Run time Error – 2147217843 Login failed for user 'SA'

I want to share my experience, when i run my Visual Basic(VB6) app on Windows 7, my app gives me "Run time Error – 2147217843(80040e4d) Login Failed for user 'SA'". My app work fine on Windows XP, but on Windows 7 occurs that error message. First I'll try to connect via ODBC on Windows 7 to my database server, and it works fine. Second i check my app component like ocx and dll. Finally I trying to compile my app on Windows 7 machine, and i found strange case. 

I used connection string to connect database server, when my app open connection (, my connection string changes itself, and there is NO PASSWORD in there, so my code gives me an error "Run time Error – 2147217843(80040e4d) Login Failed for user 'SA'".


Provider=SQLOLEDB.1;Password=p455w0rd;User ID=SA;Initial Catalog=DB2;Data Source=192.168.x.x


Provider=SQLOLEDB.1;User ID=SA;Initial Catalog=DB2;Data Source=192.168.x.x;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=CCP-PC;Use Encryption for Data=False;Tag with column collation when possible=False;

After googling i found this link that help me out from my problem. This article told me that i should add attribute on my connection string with ; Persist Security Info=true. That because on Windows Vista or Windows 7 has new security fix, that caused error on connection string. Finally after i add ; Persist Security Info=true on my connection string, IT SOLVED my problems !

Sample connection string like below
Provider=SQLOLEDB.1;Password=p455w0rd;User ID=SA;Initial Catalog=DB2;Data Source=192.168.x.x;Persist Security Info=true 

related links:

Labels: , , ,


Anonymous Anonymous said...

Thanks!!! This was exactly what I needed

11:39 AM  
Blogger Charles Chang said...

Thank you. It is useful!

2:48 AM  
Blogger rakesh said...

Thank you. It helped me

3:45 PM  

Post a Comment

<< Home