473,372 Members | 819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

tracing sql from code

Hi
I want to trace all the selects/deletes/modifys whatever on a database
in an application that are performed in a seperate application.
I need to look into this, any ideas?

- Can triggers do this kind of thing
- Can you somehow access the profiler via OLE or similiar to do this?
- Anything else?

Ta
F
Jul 20 '05 #1
5 1554
(fo******@yahoo.co.uk) writes:
I want to trace all the selects/deletes/modifys whatever on a database
in an application that are performed in a seperate application.
I need to look into this, any ideas?

- Can triggers do this kind of thing
- Can you somehow access the profiler via OLE or similiar to do this?
- Anything else?


It would probably help if you told us what you want to achieve with this.
If you are into auditing, check out Entegra from Lumgient
(www.lumigent.com.)

If you want to write your Profiler-sort-of-thing, you can use server-side
traces. Look up the sp_trace_xxxx procedures in Books Online.
--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2
Erland Sommarskog <so****@algonet.se> wrote in message news:<Xn**********************@127.0.0.1>...
(fo******@yahoo.co.uk) writes:
I want to trace all the selects/deletes/modifys whatever on a database
in an application that are performed in a seperate application.
I need to look into this, any ideas?

- Can triggers do this kind of thing
- Can you somehow access the profiler via OLE or similiar to do this?
- Anything else?


It would probably help if you told us what you want to achieve with this.
If you are into auditing, check out Entegra from Lumgient
(www.lumigent.com.)

If you want to write your Profiler-sort-of-thing, you can use server-side
traces. Look up the sp_trace_xxxx procedures in Books Online.


Its my my own debugging use. I've got a little utility that shows a list
of tables and the records of that table in a DataGrid on the right. I would
like to be able to press a button on that tool, do some database stuff,
then press some other button and see all the tables that have been modified
turn red.
Again, this is just for my own debugging use and I can completely reck the
database if need-be so anything goes.

Thanks for the response, the sp_trace_xxx stuff sounds like what I need. As
I'm new to (relational) databases it would be nice to know what else is
out there that can do this kind of thing. Can you make the database call
a program via some kind of Observer pattern, something else?
I only just learnt about the sysobjects table the other day and thats proved
to be dead useful.
Jul 20 '05 #3
(fo******@yahoo.co.uk) writes:
Thanks for the response, the sp_trace_xxx stuff sounds like what I
need. As I'm new to (relational) databases it would be nice to know what
else is out there that can do this kind of thing. Can you make the
database call a program via some kind of Observer pattern, something
else?


You can call external code in two ways: OLE objects or extended stored
procedures (XP). Writing your own XPs is certainly an advanced feature,
and requires C/C++ skills. Once they are there, calling them is more
or less like calling any other SP. To talk with OLE objects you use
the system procedures on the family sp_OAxxxx.

But I cannot see than any of these has any place in what you want to do
for debugging.

--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #4
> You can call external code in two ways: OLE objects or extended stored
procedures (XP). Writing your own XPs is certainly an advanced feature,
and requires C/C++ skills.
c#? Doing mainly web stuff at the mo but can do Windows Forms stuff as well
Once they are there, calling them is more
or less like calling any other SP. To talk with OLE objects you use
the system procedures on the family sp_OAxxxx.

But I cannot see than any of these has any place in what you want to do
for debugging.


just thinking from an mvc type of view, table changes, view is informed.
Probably not the way to go though.
Jul 20 '05 #5
(fo******@yahoo.co.uk) writes:
You can call external code in two ways: OLE objects or extended stored
procedures (XP). Writing your own XPs is certainly an advanced feature,
and requires C/C++ skills.


c#? Doing mainly web stuff at the mo but can do Windows Forms stuff as
well


Don't know if you can write unmanaged code in C#, but if you can maybe.
But you are certainly not in the sheltered realms of the CLR, but you
are responsible for keeping track of your pointers yourself. And this is
even more nervous in the context of an extended stored procedure. Tt's
not only your small little DLL that perishes in case of an access
violation - you will bring the entire SQL Server with you in the fall.

--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Trace User | last post by:
Hello, I have a design question regarding Tracing and Trace Switches. I understand that Trace Switches can be configured through an application's .config file. When a switch is instantiated,...
0
by: Paul Ibison | last post by:
HI when I have a page which calls a component I want to do the following - tracing set to false on the pag tracing set to true in the componen tracing set to false in the page after the call to...
5
by: Dabbler | last post by:
When I first start up an ASP.NET application with tracing enabled in web.config the first few pages show trace at bottom of the page but then at some point the pages return to normal with no trace...
6
by: serge calderara | last post by:
Dear all, I have an applicatin that generate a querry to an SQL server, then display results on a second webform. I try to see how tracing works, then I have notice that as soon as I...
2
by: deepukutty | last post by:
Hi all, I know tht we can do tracing in two ways.one in application level and the other is at Page level. I am able to see the details of trace either on the page itself or .../trace.axd page....
3
by: Tim Mavers | last post by:
Is there an easy way to turn on soap tracing of some sort for a web service? We have built a web service (in production) that is experiencing problems for a client. Is there an easy way we could...
0
by: cnys | last post by:
We have an ASP.NET 2.0 (C#) app and we're trying to add tracing into it. The tracing functionality within .NET is great, but when we output this to a file, it's kind of sparse. So, we're looking...
0
by: rehto | last post by:
We have an ASP.NET 2.0 (C#) app and we want to enable tracing (see the code snippets below). The first time a user navigates to the app., the tracing works fine (the ASP.NET tracing appears on...
6
by: Stephen Torri | last post by:
I am trying to produce a singleton class that I can use throughout my library to write tracing information to a file. My intent was to design such that someone using the library in its debug mode...
1
by: RedLars | last post by:
Hi Does the class System.Diagnostics.Trace use a singelton ? I'm able to do this; System.Diagnostics.Trace.WriteLine("test"); However, these give compiler errors; System.Diagnostics.Trace...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.