Re: SqlCommand Open VERY slow on application load

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Andre Ranieri (AndreRanieri_at_discussions.microsoft.com)
Date: 02/04/05


Date: Fri, 4 Feb 2005 11:35:02 -0800

I have to think that 45 seconds to create a SqlConnection is not a normal
thing, even for managed code like .NET.

If you run SQL Profiler, do you start seeing the log fill up as soon as you
F11 step into the conn.Open() line or does the Profile log sit empty for the
45 seconds and fill at the end? How about memory usage on your laptop? does
it hit the roof when it hits this line? I'm guessing it doesn't.

I'm running a very similar situation, 2.4GHz Pentium IV 2.4 notebook w/ 1 mb
memory, currently developing an ASP.NET app that includes web.config
connection strings to two separate SQL 2000 servers. I'm not seeing any
noticable delay when creating, instantiating and opening a SQLConnection
object.

One last point of curiosity: it looks like your first call to the database
is through a SqLCommand to a datareader of something like that. What if your
first call is to fill a dataset using a data adapter? I know a da
automatically handles connection state for the connection, maybe that would
be faster?



Relevant Pages

  • Re: scalability of single SqlConnection instance
    ... Do you mean lock on the specific SqlConnection instance being used for the operation? ... Yes, you can consider a new "feature" that can permit multiple operations on a single connection, but it has so many side-effects, I don't recommend it. ... I think that technically my architecture is thread-safe (since only a single thread can make use of my single SqlConnection instance at once), but it's hardly a desirable way to do things. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: scalability of single SqlConnection instance
    ... Do you mean lock on the specific SqlConnection instance being used for the operation? ... another connection when needed. ... I think that technically my architecture is thread-safe (since only a single thread can make use of my single SqlConnection instance at once), but it's hardly a desirable way to do things. ... there is a connection pool at client side for SQL Server. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Data access layer + sql connections
    ... > would be interested in hearing opinions from more experienced .NET ... > I am building a data access layer that encapsulates my business entities. ... > SqlConnection and issues the relevant SQL commands. ... and this transaction object should contain the connection. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Very strange SQL connection problem
    ... Try creating a *new instance* of SqlConnection and then open and after the ... > connection string again and got the second exception after ... > Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior ...
    (microsoft.public.dotnet.framework.adonet)
  • Developing asp.net with VS.NET 2003
    ... I made a base class for data that retrieved the connect string. ... a new SQLConnection with the connection string. ...
    (microsoft.public.vsnet.general)