Home All Groups Group Topic Archive Search About


Author
7 Jun 2006 2:30 PM
CNemo
Hi all!

I need to write some tracing code for legacy applications. Basically there
is the need to trace SQL sent to server from ASP app. Code is very
unstructured and dirty, so there is no single point where i can inject this
functionality.

What i would like to do is create some procedure and attach it to connection
object when i need it.
The only concern is that i'm not sure that i can attach events. Is this
doable in ASP + ADO?

Or may be somebody can advise another approach to track. But i havent acces
to servers (neither IIS nor Sybase database).

Any help will be gratly appreciated!

Author
7 Jun 2006 4:19 PM
Pexi
I don't quite get what do you mean with events here, and I don't know
Sybase, but maybe there is a similar tool as Profiler is in SQLServer2000.
If yes, it can be used for tracing, no need to change anything in your app.

Another easy option which comes to my mind is that if your connection is via
ODBC, you should be able to configure the driver so that it writes some kind
of trace log.

Otherwise... if you are using ADO, you might consider writing an
ADO.Connection wrapper class with logging features. Then just your own
WrappedConnection instead of the ADO.Connection itself.

Just some ideas.
/pexi


Show quote
"CNemo" <mikeevt***@yahoo.com> wrote in message
news:ehcqk8jiGHA.836@TK2MSFTNGP02.phx.gbl...
> Hi all!
>
> I need to write some tracing code for legacy applications. Basically there
> is the need to trace SQL sent to server from ASP app. Code is very
> unstructured and dirty, so there is no single point where i can inject
this
> functionality.
>
> What i would like to do is create some procedure and attach it to
connection
> object when i need it.
> The only concern is that i'm not sure that i can attach events. Is this
> doable in ASP + ADO?
>
> Or may be somebody can advise another approach to track. But i havent
acces
> to servers (neither IIS nor Sybase database).
>
> Any help will be gratly appreciated!
>
>
Author
7 Jun 2006 5:53 PM
CNemo
Thanks for your response!

> Otherwise... if you are using ADO, you might consider writing an
> ADO.Connection wrapper class with logging features. Then just your own
> WrappedConnection instead of the ADO.Connection itself.

The idea was to alter existing code as less as possible. Having wrapper
means i need to alter object creation code, which is quite intrusive. Also,
this way i need to write wrapper and deploy it to the production server.
Greatly doubt that i have this luxury. By the same reason i cannot turn ODBC
tracing.

I was in hope that i can attach to connection object events somehow and only
when i need it. I know that VB has something like GetRef function to get
reference to the subroutine address. Is this available in ASP?
Author
7 Jun 2006 6:09 PM
Bob Barrows [MVP]
CNemo wrote:
Show quote
> Thanks for your response!
>
>> Otherwise... if you are using ADO, you might consider writing an
>> ADO.Connection wrapper class with logging features. Then just your
>> own WrappedConnection instead of the ADO.Connection itself.
>
> The idea was to alter existing code as less as possible. Having
> wrapper means i need to alter object creation code, which is quite
> intrusive. Also, this way i need to write wrapper and deploy it to
> the production server. Greatly doubt that i have this luxury. By the
> same reason i cannot turn ODBC tracing.
>
> I was in hope that i can attach to connection object events somehow
> and only when i need it. I know that VB has something like GetRef
> function to get reference to the subroutine address.

How would that help? Knowing the address of the subroutine is a far cry
from monitoring the inputs or outputs of that process at runtime.

> Is this
> available in ASP?

There is no way to achieve what you want without altering the existing
code.
Sorry

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Author
8 Jun 2006 10:09 AM
Patrice
You could start wrapping Recordset.Open in your own function so that you can
add the tracing (you'll have to change the code anyway even if for nothing
else than anbling tracing). Knowing exactly what you are doing exactly might
help (for example we store just the last statement so that we can have this
in our error reporting page, do you want to trace all statements ? where ?
When do you clear ? etc...)

--
Patrice

"CNemo" <mikeevt***@yahoo.com> a écrit dans le message de news:
ehcqk8jiGHA.***@TK2MSFTNGP02.phx.gbl...
Show quote
> Hi all!
>
> I need to write some tracing code for legacy applications. Basically there
> is the need to trace SQL sent to server from ASP app. Code is very
> unstructured and dirty, so there is no single point where i can inject
> this functionality.
>
> What i would like to do is create some procedure and attach it to
> connection object when i need it.
> The only concern is that i'm not sure that i can attach events. Is this
> doable in ASP + ADO?
>
> Or may be somebody can advise another approach to track. But i havent
> acces to servers (neither IIS nor Sybase database).
>
> Any help will be gratly appreciated!
>
Author
9 Jun 2006 12:00 PM
CNemo
> You could start wrapping Recordset.Open in your own function so that you
> can add the tracing (you'll have to change the code anyway even if for
> nothing else than anbling tracing). Knowing exactly what you are doing
> exactly might help (for example we store just the last statement so that
> we can have this in our error reporting page, do you want to trace all
> statements ? where ? When do you clear ? etc...)

My client wants to switch to the new ODBC driver version. They asked to do
kind of test harness, very primitive one.
I need collect input from app and find out what's changed in database. Then
do same input with new driver and compare results. They don't care if
result is correct, but they want same result. :-0 The problem is that they
do not want to do this properly using server tools, but app itself only.
Look like i have to go all over this old crappy code and found every single
place where sql constructed and save and document it.

I cannot use ODBC tracing, because it's on production server i cannot
control. By the same reason i cannot install any other components there.
Also, Sybase used, so there is no profiler on the client (as far as i know).

AddThis Social Bookmark Button