Getting ColdFusion SQL Statements from SQL Server Trace

Running a SQL Trace in the SQL Server Profiler can be a great way to track down performance problems in your ColdFusion application. However if you have tried to run one, you probably didn't see the actualy SQL queries your ColdFusion application was sending, only things like this:
RPC:Completed exec sp_execute 1,2,4
The reason for this is that ColdFusion's JDBC Driver for SQL Server passes SQL statements through the sp_execute stored procedure, so you are only seeing the stored procedure call. You need to enable an event that is not enabled by default, the SP:StmtCompleted event.
When you start your trace click on the Event Selection tab, and then check Show all events then find SP:StmtCompleted under the Stored Procedures node.
The above was tested on SQL Server 2005, you may have a different UI on previous versions.
Now when you run your trace you should see your SQL Statements in the TextData column where EventClass is SP:StmpCompleted
Tweet
add to del.icio.us
| Tags: sql, sqlserver, profiler, trace, coldfusion, cf, cfml
Related Entries
- Mastering CFQUERYPARAM - July 24, 2008
- Announcing CFML Weekly Email - October 19, 2012
- Client Variable Cookie CFGLOBALS Includes Session Ids - July 14, 2011
- Maximum Security CFML - cfObjective Slides - May 17, 2011
- Writing Secure CFML Slides from CFUnited 2010 - August 5, 2010
Trackbacks
Comments
Post a Comment
Recent Entries
- Writing Secure CFML cfObjective 2013 Slides
- Upgrading to Java 7 on Linux
- J2EE Sessions in CF10 Uses Secure Cookies
- Learn about ColdFusion Security at cfObjective 2013
- Session Loss and Session Fixation in ColdFusion
- FuseGuard 2.3 Released
- CKEditor Spell Checker Plugin
- Adobe Says Go Ahead and Upgrade your ColdFusion JVM





