How to monitor SQL sent to server

Posted on 2007-07-20
Medium Priority
Last Modified: 2013-11-26
I'm having a problem with a Gridview's update statement in VS2005/Postgress SQL server. On testing this on my local PC running VS2005, and hitting a Postgres SQL server on a differnt box.  I'm trying to find a way to monitor the SQL that is sent to the server, as I'm doing something wrong. With MS SQL Server, I have SQL Profiler. But I don't think any such tool exist with Postgres.

Any suggestions in VS2005 on how to capture this? Any tool recommend to work with Postgres?

We are using corelab's .net drivers for Postgres. http://www.crlab.com/

On my DEV PC I'm trying to run their DBmonitor. I'm trying to find all the documentation for this. I've been working with this: ms-help://MS.VSCC.v80/CoreLab.PostgreSql/PgSQLDirect/DbMonitor.html

Since this is an asp.net page, there is no form to drop the control into per the instructions. I click on VS2005/view/compnent designer and I can drag the compoent onto the dark grey page which in turn places the code in the aspx.vb page. I see the option to Set PgSqlMonitor.IsActive. I activate the DBmonitor app, I then run the web page and get nothing in DBmonitor.

So I move onto the second half of the directions below: Using DBMonitor with ASP.NET projects

However, I don't have the processtag in my machine.config file.
Question by:Thirt
LVL 10

Accepted Solution

adrpo earned 2000 total points
ID: 19544053

My idea would be to monitor this at the PostgreSQL sever (of course if you have access) using the log:
log_statement (string)
Controls which SQL statements are logged. Valid values are none, ddl, mod, and all. ddl logs all data definition statements, such as CREATE, ALTER, and DROP statements. mod logs all ddl statements, plus data-modifying statements such as INSERT, UPDATE, DELETE, TRUNCATE, and COPY FROM. PREPARE, EXECUTE, and EXPLAIN ANALYZE statements are also logged if their contained command is of an appropriate type. For clients using extended query protocol, logging occurs when an Execute message is received, and values of the Bind parameters are included (with any embedded single-quote marks doubled).

Read more here:

LVL 15

Expert Comment

ID: 19606293
If you are using PostgeSQL ODBC drivers (pgODBC), one of the options there is logging all queries to a local file. You can look it up by setting up a file DSN with that checkbox checked, then looking at the content of that file. The option is somewhere under "advanced", 2nd page.

Author Comment

ID: 19608586
Thanks for the replies. But I'm using a .net driver, not ODBC. And Adpro's solution worked perfectly.

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

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

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month17 days, 5 hours left to enroll

862 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