How To Get The SQL Server SPID Out Of SeeFusion
Posted by
Brad Wood
Sep 22, 2009 05:19:00 UTC
I've never kept too quiet about my affection for SeeFusion as a ColdFusion monitoring tool. I use it for debugging, performance monitoring, and basic metrics gathering. Here's an old note on the JDBC URL wrappers that I found myself digging up last week. I don't even think you can find this nugget on the official SeeFusion site.One of the best features of SeeFusion is its ability to introspect your database calls and report back to you the SQL being run, how many records it has returned, and how long it is taking. To enable this you must re-add your data sources using the JDBC URL encased in a call to the SeeFusion JDBC wrapper. The wrapper proxies the SQL commands to your database but has the ability to monitor the data going both directions.
A regular JDBC URL:
[code]jdbc:macromedia:sqlserver://10.1.2.3:1433; databaseName=myDatabase; SelectMethod=direct; sendStringParametersAsUnicode=false; MaxPooledStatements=1000;[/code]A SeeFusion-wrapped JDBC URL:
[code]jdbc:seefusion:jdbcwrapper:{jdbc:macromedia:sqlserver://10.1.2.3:1433; databaseName=myDatabase; SelectMethod=direct; sendStringParametersAsUnicode=false; MaxPooledStatements=1000;};[/code]If you want to research a particularly long-running query on your website or build a custom monitoring app yourself based on SeeFusion's data (Available as XML via a web API) you would probably want to know the SPID the query in question was running as. To get this data back for SQL Server connections (as well as the database name and server name) simply add the following text to the end of your JDBC URL: "dialect=sqlserver"
[code]jdbc:seefusion:jdbcwrapper:{jdbc:macromedia:sqlserver://10.1.2.3:1433; databaseName=myDatabase; SelectMethod=direct; sendStringParametersAsUnicode=false; MaxPooledStatements=1000;};dialect=sqlserver[/code]This will cause the following extra text to be reported below your query information reported by SeeFusion:
[code]{DB=myDatabase, SPID=64, Server=myServer}[/code]Well, there you have it! Let me know if you are using SeeFusion and if you this helped you.