question

AllanStark avatar image
0 Votes"
AllanStark asked MotoX80 commented

Old VB6 application can't connect to the MS SQL 2008R2 Server with 18456 error

I have old application, written on VB6.
After migrating it from Windows 7 to Windows 10, the application cannot connect to the old SQL server.

In SQL Server logs:
Login failed for user '...'. Reason: Password did not match that for the login provided. [CLIENT: ...]
Error: 18456, Severity: 14, State: 8.

If I change the user password (both, in MS SQL server in on the Windows 10 workstation) to an empty one, the connection occurs without any problems.

Tried to forcibly enable TLS 1.0 & TLS1.1 in Windows registry.
Also tried to install latest SQL Native Client & OLE DB Driver for SQL Server.118014-3.png


not-supported
3.png (84.0 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MotoX80 avatar image
0 Votes"
MotoX80 answered AllanStark commented

I would recommend using Visual Studio upgrade wizard to upgrade the project to a supported .Net version.

https://www.bing.com/search?q=visual%20studio%20upgrade%20vb6%20to%20.net

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Unfortunately I have only compiled .exe file.
In addition, tested with empty password and all works as should.

0 Votes 0 ·
MotoX80 avatar image
0 Votes"
MotoX80 answered MotoX80 commented


Unfortunately I have only compiled .exe file.

I kind of figure that was the case. Dusting off the VB6 cobwebs in my brain.... not sure that any of this will help, but here's what pops up...

I remember that I could "dim objConnection as ADODB.Connection" (or something like that) but that added a reference to a specific version at compile time and I had problems when I tried to run the app on other machines. Doing a "CreateObject" made it more portable, so I would expect that's what your app is doing if the program can at least launch. We should be able to use VB script to test the connection.

Do you know what the password should be? Or what the connect string is? Does the app use an ODBC DSN by chance?

If you don't have the source code, then you can try using the strings utility to see if can find the connect string in the .exe file. Then plug that into a test.vbs file

https://docs.microsoft.com/en-us/sysinternals/downloads/strings

 strings -n 8 YourApp.exe > C:\temp\YourApp.txt
 notepad C:\temp\YourApp.txt 

Modify this script with your names. VB6 is 32 bit so you need to use c:\windows\syswow64\cscript.exe to run the test script.


 Set oConn = CreateObject("ADODB.Connection")
 Set oRs = CreateObject("ADODB.Recordset")
 oConn.Open "driver={sql server};server=YourSQLServer;database=YourSQLDB;uid=xxxxxxx;pwd=xxxxxxxx"
 wscript.echo "Connection opened"
 strSQL = "SELECT * from YourTableName"
 oRs.Open strSQL, oConn
 wscript.echo "Recodset opened"
 oConn.Close
 wscript.echo "Looks like it works."



Update: if you don't find the password in the C:\temp\YourApp.txt then maybe the app is looking for a registry entry or a file that contains the pswd and does not exist on the new server. If it just ignores the error, then you would end up with an empty variable that should contain the password. That might explain how the app is able to connect with a null password.

Do you see any references to registry entries or file names in YourApp.txt?

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

The application asks for a password at startup, it obviously does not store it inside itself.
It also doesn't use salt, because then an empty password would not work.

0 Votes 0 ·

Then try the VB script with that password.

0 Votes 0 ·