Reverse Engineer a SQL Profiler Trace

Posted on 2006-10-19
Medium Priority
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.
Question by:kevinvw1
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 29

Accepted Solution

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!

Author Comment

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.
LVL 29

Expert Comment

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...

Author Comment

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.

LVL 29

Expert Comment

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.

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

649 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