tags:

views:

128

answers:

4

Situation:

  1. I have a program written in VB6
  2. The source code of the program is not available
  3. It connects to a database using ODBC connection string.
  4. The vendor setup a connection name to the database when the program was first installed 6 years ago
  5. My machine crashed, all the settings are gone!
  6. The program vendor is out of business. Even they don't have the source of the program now.

Question:

Can I find the ODBC connection name in anyway?

Update:

I found the string using Process Explorer (method described to @Beaner). Thanks for all the guys who spent their valuable time to help a mere mortal!

A: 

Can't you use a decompiler?

Shoban
I tried OllyDbg, but with no success!
sagara
A: 

You can probably run an ODBC trace and then look in the log file to see what the attempted name was. Run odbcad32.exe and go to the trace tab and turn it on. Run your app and then look in the log file (probably at the SQLConnect call).

Mark Wilkins
+1 for this suggestion. It doesn't show the connection string, though. :(
sagara
That's too bad. I didn't try a trace with a connection string. If you have a "strings" utility, you might just run it on the application binary and dump the output to a file. A scan through it might show what the name is. Or even a hex editor should reveal the connection string. I just wrongly assumed the ODBC trace would show it. Sorry about that.
Mark Wilkins
+1  A: 

You can use process explorer to catch the connection string your program is trying to open. If you have never used this tool before you can catch almost everything a program is doing and you can filter what information is captured / displayed.

Beaner
How can I use it to capture ODBC string? I have working knowledge in PE, but can't figure out how it can be used in this scenario.
sagara
It will tell you every reg key and file it tries to access.
Beaner
At last I managed to find the string using PE! The method is: (1) Find the access database's password using MdbPassword Sniffer (NirSoft) (2) Dumped all strings using PE (3) Searched for the password in the file (4) Found connection string near the password text match. Your suggestion helped me a lot man!
sagara
A: 

I'm not sure I've understood. What exactly happens when you try to run the program? Is the problem that the ODBC connection string was lost because the settings were lost when your machine crashed?

If so I would try the following.

  • Look on a backup for the configuration file of the VB6 program. It may be an INI file.
  • Do you know what the database is? Is it an Access file (*.MDB), SQL Server, or what? You may be able to recreate the connection string from scratch. You might have problems if you need to supply a password.
  • Are you still in contact with anyone from the vendor? I'd have thought whoever originally wrote the program would be best able to help, and might be willing to do a couple of days consultancy.
MarkJ
Thanks for your reply. I found the string using the method I described to Beaner. +10 for pointing out that connectionstring website! Priceless! :)
sagara