Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

GO-SQL blog A blog dedicated for SQL Server Developers alike!

My name is Andrew Fenna, and I am a database developer at The Laterooms Group. I have written this blog to educate my fellow database developers in subjects that I think are necessary to keep at the top of our game. I have been working with RDBMS’s since 2002 and I have worked within financial, gaming, public, and travel sectors within the Northwest of England. I have gained quite a lot of experience throughout my journey and have tackled some very difficult challenges along the way. Therefore, I am blogging my experiences, which I hope will give you the inspiration to try and tackle problems that are deemed impossible to start, but with some encouragement and guidance become much more simpler and structured, thank you for your time. Andrew J Fenna.

Run real-time SQL tracing at application level with a ORM….

If you ever need to know exactly what dml your application is running as you have an ORM as your persistence layer like NHiberate. The most effective way is to add an application name parameter to your ado connection string and use SQL Server Profiler, to listen for this application, see below:-

Change application’s ado connection string:-

“Data Source=XXXXX;Initial Catalog=XXXXXX;Integrated Security=True;Pooling=False”

To:-

“Data Source=XXXXX;Initial Catalog=XXXXXX;Integrated Security=True;Pooling=False;Application Name=GOSQL”

Go to SQL Server Profiler, start a new profile using the standard ‘SQL’ profile.

On the ‘Events Selection’ tab select ‘Show all columns’.

Select ‘Column Filters’.

Select ‘ApplicatioName’ expand ‘Like’ enter your application name, and select ‘Exclude rows that do not contain values’.

Select ‘OK’, and ‘Run’.

Any request coming through as your application name will be profiles for analyzing later.

This is a very good technique if your are trying to identify what dml the ORM is rendering under the hood. Once you have identified your the dml, you can tackle your problem with a better understanding of what the application and database are trying to do.Image


Comments

Leave a comment on the original post [gosqlblog.wordpress.com, opens in a new window]

Loading comments...