It depends on which database you are connecting to, and whether it is local or network, and network speed, if so. If everything is local, then maybe 1 or 2 milliseconds (again, it depends on the DBMS). If, more realistically, it is over a local area network, it can still be pretty fast. Here is a simple example of connecting to a server on a different subnet (I think one hop):
for ( int i = 0; i < 5; i++ ) { Stopwatch timeit = new Stopwatch(); timeit.Start(); AdsConnection conn = new AdsConnection( @"Data Source = \\10.24.36.47:6262\testsys\;" ); conn.Open(); timeit.Stop(); Console.WriteLine( "Milliseconds: " + timeit.ElapsedMilliseconds.ToString() );
Below are the print dates. The very first one has the cost of loading assemblies and various DLLs. The following are just a measurement of the initialization of new connections:
Milliseconds: 99 Milliseconds: 5 Milliseconds: 4 Milliseconds: 4 Milliseconds: 4
source share