views:

914

answers:

4

hi there,

i wonder if there is something similar to Sql Profiler for Sql Server Compact Edition? i use SqlCE as backend for a desktop application and it would be really great to have something like sql profiler for this embedded database. or at least something simliar to the NHibernate show_sql feature... any ideas? thanks j.

A: 

Try to install a Standard version (with the profiler) and you might be able to connect to the CE instance also.

xnagyg
I think CE does not include any hooks for profiling, its a stripped down version of SQL it has no service and Im fairly sure it doesnt listen on any ports once you invoke it from your app.
Sam Saffron
+1  A: 

I don't think that would work - CE seems like a totally different beast.

You can enable some logging that might help you:

http://msdn.microsoft.com/en-us/library/ms171949(SQL.90).aspx

I tried to do this and managed to set the database up and connect from SSMS - you have to specify the alternate connection type of 'SQL Server Compact Edition'. Profiler has no such thing - and entering a path to the datafile for the 'database' field did nothing.

Sam
+1  A: 

The only tested solution I know of that could solve this problem is Altiris Profiler which is a tool I designed at my previous job, but is closed source and not-for-sale.

The way you would hook it in, is by creating a factory for your commands and proxing them for profiling purposes before using them (using RealProxy). Its really light weight and about 10 lines of code to implement.

On my question Flory talks about a new tool called dynaTrace that may also be able to solve this problem as well.

Sam Saffron
Thanks for letting everyone know about a 'tested solution' that they can't use! Sit back and watch the votes come rolling in! :)
Mitch Wheat
Mitch, there are a few key points you are missing here ... you could lobby Symantec to sell the Altiris profiling suite if you think its really useful. You could build a light weight SQL profiler using the RealProxy mechanism I talked about and you could look into dynaTrace ...
Sam Saffron
I should just post a picture of a doughnut, it seems to be better regarded than actual information: http://stackoverflow.com/questions/211426/what-punishment-do-you-have-when-someone-on-the-team-breaks-the-build#211461 :(
Sam Saffron
A: 

I think that its possible that it could be done using the Default Profiler Trace Template (from Visual Studio 2008). I talk about using the template for a non-CE version of SQL in my weblog at: http://codingathome.blogspot.com/2009/04/create-sql-trace-and-read-it-using-sql.html .

Its possible that template would work for the CE version of SQL. I haven't tried it. Your milage might vary. I know that SQL CE doesn't support stored procedures so chances are this wont work. You might have to setup debugging in your code in order to trace queries.

Since CE doesn't support a stored procedure I bet you can still run the script as a .sql script and get the tracing events installed. Its worth a try.

djangofan