How to use Profiler with LocalDB?

5 posts, 1 answers
  1. Keith
    Keith avatar
    19 posts
    Member since:
    Nov 2011

    Posted 27 Jun 2012 Link to this post

    I haven't been able to connect the Profiler (V 2012.2.607.1) to connect to LocalDB.

    I've tried as Server:

    (LocalDB)\V11.0
    but I get an invalide URI error

    localhost
    gives no error but doesn't connect

    I'm pretty sure I've followed all the steps, including the startup code, the backend configuration, and the reference.

    How do I do this?

    BTW, here's my connection string:

    <add name="ConStrApptHero" connectionString="data source=(LocalDB)\V11.0;initial catalog=MyDB;integrated security=True" providerName="System.Data.SqlClient" />
  2. Keith
    Keith avatar
    19 posts
    Member since:
    Nov 2011

    Posted 28 Jun 2012 Link to this post

    Can I get an answer to this?

    Does Profiler work with LocalDB?

    If so, how can I figure out what I'm doing wrong?
  3. DevCraft banner
  4. Answer
    Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 29 Jun 2012 Link to this post

    Hi Keith,

    Sorry for the delayed reply, we are quite busy with the preparation of the new service pack.
    The OpenAccess profiler is used absolutely the same way with LocalDB as with any other backend:
    - Enable logging data in the rlinq file, as described here. You could try a higher log level like Verbose or All in order to get more messages.
    - Start the profiler service at the beginning of the application execution.
    - Connect the profiler using localhost as server name (if the application is running on your local machine), the port specified in the StartProfilerService method call and the connection string name used in the application.

    Please note that if the application has not been started yet, the profiler will not be able to connect and will display errors. However, it will continue trying to connect and if you start the application later, you should be able to see the log data.
    If the application is running and an OpenAccessContext instance is already created (a connection to the database has been established), you should even be able to see the connection string in the combobox of the Profiler's Open Connection dialog.
    Hope that helps.

    Greetings,
    Alexander
    the Telerik team
    OpenAccess ORM Q2'12 Now Available! Get your hands on all the new stuff.
  5. Keith
    Keith avatar
    19 posts
    Member since:
    Nov 2011

    Posted 29 Jun 2012 Link to this post

    Thank you for your reply.

    Turns out it was my own stupidity.

    I had added this

    Telerik.OpenAccess.ServiceHost.ServiceHostManager.StartProfilerService(15555)

    to my main form, but for troubleshooting, I created a test startup form and failed to put that code in it's Load.

    So, everything I was testing with profiler failed because my test form didn't have that code.

    Sorry to have wasted your time.

    But, you answer did help me by confirming that localhost is the correct server for LocalDB.
  6. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 29 Jun 2012 Link to this post

    Hi Keith,

    I am happy to see that you have found the problem. Please note that the server address is not the address of the database server, but the address of the machine where the OpenAccess profiler service is running. So if your application is running locally, the server will always be localhost, for any backend. If you are profiling an application running on a remote machine, you should use the IP of that machine instead.

    Kind regards,
    Alexander
    the Telerik team
    OpenAccess ORM Q2'12 Now Available! Get your hands on all the new stuff.
Back to Top
DevCraft banner