?
Solved

Reverse Engineer a SQL Profiler Trace

Posted on 2006-10-19
5
Medium Priority
?
500 Views
Last Modified: 2008-03-06
I am working with a MSSQL based application that has a COM interface for programming/integration.
If I run a sql trace on the database while entering a record into the application I can clearly see what is going on.
In fact the manufacturer suggests that developers use SQL traces to 'reverse-engineer' the application when
trying to integrate with it.

Here is my current approach:
I take pieces of the sql trace log, visually parse it out, figure out what kind of sql command is being called,
and convert that (in VB) to the appropriate COM calls for the appliations COM object.
The process is a bit tedious.

Does anyone have any suggestions on how to parially automate this process?
I am thinking that I am going to have to write my own parsing logic to parse out the trace log, but just want to be sure
that there is no magic utility out there that already does something similar.

Thanks,  Kevin.
0
Comment
Question by:kevinvw1
  • 3
  • 2
5 Comments
 
LVL 29

Accepted Solution

by:
Nightman earned 2000 total points
ID: 17766613
None that I know of.

What I can tell you is that any manufacturer/supplier that told me to run a sql trace to see what is happening internally in their application if I need to integrate to it will be shown the door - this indicates poor system documentation (and therefore possibly poor change management and quality control as well). If they don't have a published SDK, they should at LEAST be able to show some system documentaion!
0
 

Author Comment

by:kevinvw1
ID: 17766656
Let me explain -

They actually do have decent documentation, but their COM does not enforce business logic.  For example if you enter a new record via the gui, it populates several tables, enforcing the business logic to insure that a "complete" record is created.  
Create a new company/contact record populates the company, person, address, phone, etc. tables.

When you use the COM object you have to populate each table separately.  Referential integrity checking is up to the programmer.  Hence, to see exactly what is happening, one can take advantage of a sql trace.

Anyway that is their application for better or for worse...FYI it is Sage Software...might as well be microsoft...can't show them the dooe ;)

Thanks,  Kevin.
0
 
LVL 29

Expert Comment

by:Nightman
ID: 17766718
We are on our 3rd Sage 'consultant' at the moment.

Some kind of data dictionary would be REALLY nice here - for you to have to capture the entire application business logic by profiling their system is insane. Do their COM datatypes also match up with the validation on the UI? Unlikely. So how do you know whether or not you have broken the integrity of the system when you post 10 into a tinyint field that the UI only allows 0-9?

Does the database enforce referenctial integrity at all? I.E. enetring a person with an invalid company will error out?

What version of Sage? Which software package? CRM, Accounting, etc...
0
 

Author Comment

by:kevinvw1
ID: 17766803
Sage CRM.

So far in my experience you can use their COM object to write data that the application can't interpret.

I have not messed around with their Web Services yet, so I'm not sure if it does any better job of enforcing things.

For your example, yes, I could create a person record and assign a company id to that person record even if that company id doesn't actually exist in the company table!

I happen to be a Sage 'consultant'...fortunately I am first and foremost a 'programmer'...and debugging other people's apps is my specialty so I feel right at home with this app...lol

Fun stuff.

Thanks, Kevin.

0
 
LVL 29

Expert Comment

by:Nightman
ID: 17766872
No way that I know of to automate this. And ideally you are going to want to work with a single connection to a system at a time (far easier to trace the logic if you know that there is only one connected user). Trying to split out the logic when there are hundreds (or even dozens) of concurrent connections will be painful in the extreme.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question