UnkwnTech
UnkwnTech

Reputation: 90851

Finding SQL queries in compiled app

I have just inherited a server application, however it seems that the only copy of the database is corrupt and the working version is gone, so is it possible to find what queries the application is running so I can try to rebuild the tables?

Edit: I have some files with no extensions that I are named the same as the databases, IDK if there is anything that can be done with them but if anyone has any ideas.

The accepted answer seems the most likely to succeed however I was able to find another backup so I have not tested it.

Upvotes: 2

Views: 340

Answers (5)

Nathan Koop
Nathan Koop

Reputation: 25197

You could RegEx the files to search for

  • "SELECT *"
  • "UPDATE *"
  • "DELETE FROM *"
  • "INSERT INTO *"

Upvotes: 0

Ed Guiness
Ed Guiness

Reputation: 35267

Look for SQL Profiler, which (depending on which version you have) is normally available from the tools menu in query analyzer (isqlw.exe) or management studio (in later versions).

With SQL profiler you can run a trace on the server which can show you which queries are being requested by the application.

Upvotes: 2

Kyle Burton
Kyle Burton

Reputation: 27528

If you have access to either a unix machine, or can install the cygwin utilities (http://www.cygwin.com/), there is a command called 'strings' which will search through any file type and print out any contiguous sequence of character data (might just be ascii). That tool should help you identify the sql queries embedded in the aplication.

Upvotes: 2

Chris
Chris

Reputation: 577

You could run the UNIX command "strings" on the program to see whether it has embedded sql strings:

http://en.wikipedia.org/wiki/Strings_(Unix)

Upvotes: 0

Jason Cohen
Jason Cohen

Reputation: 83021

Turn on SQL query logging and watch what the application asks for.

Upvotes: 3

Related Questions