Reverse Engineer a SQL Profiler Trace

Posted on 2006-10-19
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
  • 3
  • 2
LVL 29

Accepted Solution

Nightman earned 500 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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

820 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