M
Moe Sisko
Using dotnet 2.0.
Console app to reproduce issue :
==
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
namespace DBSlow
{
class Program
{
static void Main(string[] args)
{
using (SqlConnection conn = new SqlConnection("Integrated
Security=true;database=YourDB;server=.;Pooling=true"))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand("select GETDATE()")) // just do
something with SQL server
{
cmd.Connection = conn;
cmd.ExecuteNonQuery();
}
}
Console.WriteLine("done");
}
}
}
==
When this code is run, I'm seeing about a 1 to 2 second delay from the time
that : "done" gets displayed, to the time that the application terminates.
i.e. run it from a command shell, and it should be easy to see.
When I turn connection pooling off (by using "Pooling=false" in connection
string), I don't see this delay.
The delay is a problem for us, because in real life, the real app can get
called many times in a batch file.
Any ideas if this delay is by design for connection pooling ?
Any way to reduce/eliminate it with connection pooling on ?
Console app to reproduce issue :
==
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
namespace DBSlow
{
class Program
{
static void Main(string[] args)
{
using (SqlConnection conn = new SqlConnection("Integrated
Security=true;database=YourDB;server=.;Pooling=true"))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand("select GETDATE()")) // just do
something with SQL server
{
cmd.Connection = conn;
cmd.ExecuteNonQuery();
}
}
Console.WriteLine("done");
}
}
}
==
When this code is run, I'm seeing about a 1 to 2 second delay from the time
that : "done" gets displayed, to the time that the application terminates.
i.e. run it from a command shell, and it should be easy to see.
When I turn connection pooling off (by using "Pooling=false" in connection
string), I don't see this delay.
The delay is a problem for us, because in real life, the real app can get
called many times in a batch file.
Any ideas if this delay is by design for connection pooling ?
Any way to reduce/eliminate it with connection pooling on ?