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 (conn.open), 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'".
BEFORE conn.open
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 !
BEFORE conn.open
Provider=SQLOLEDB.1;Password=p455w0rd;User ID=SA;Initial Catalog=DB2;Data Source=192.168.x.x
AFTER conn.open
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: SOFTWARE, SQL SERVER, TIPS, Visual Basic