Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Timeout expired elapsed prior to obtaining a connection from the pool Winforms App

Posted on 2016-10-05
7
59 Views
Last Modified: 2016-10-31
I am getting the timeout expired elapsed prior to obtaining a connection from the pool error on a winforms app compiled on VS2010 .net 4.  I don't get this error on every computer using the program though.  I can run the same process and only get this error on 2 out of 10 computers or so.  All computers run remote, windows 7-10.  SQL server 2008.  I can't find any rim or reason to which ones work or don't work.  I am using use statements in the code.  What could I look for on the machines.  I have 2 computers in one office, one works one doesn't.  Both windows 10 64 bit.  Same fire wall, and antivirus settings.

Any suggestions on what I might be missing.
0
Comment
Question by:PDIS
7 Comments
 
LVL 20

Expert Comment

by:Russ Suter
ID: 41830198
What is your timeout set at? If you increase it does the problem go away? This might help determine whether you have a slow connection or something is just flat blocking things.
0
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 41830324
Also are you running sql express or an actual copy of sql?  Could be concurrent connections if you're running express.

Can you ping the sql server / connect to it from management studio when you get the time out?
0
 

Author Comment

by:PDIS
ID: 41830409
I moved the timeout to 120 seconds,  Based on screen updates it is processing when I get the pooling error.

Actually copy of SQL server 2008 STD.  I can still ping and connect when I get the timeout/pooling message.  I have even increases the number of pools to 200, just to see if it would finish.

I have a couple computers that will consistently get the error.  .net4 frame work.  Does it matter if or what very of the native sql client is installed.  From all my research, .net uses it own system.data.dll

Then I can run the same process on the same data on a different machine and it works just fine.
0
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 41830599
Are you closing and disposing of the connections?  It could be more a matter of garbage collection?
0
 
LVL 12

Accepted Solution

by:
funwithdotnet earned 500 total points
ID: 41830992
I think Kyle might be correct. Are you using the 'Using' statement for System.Data.SqlClient.SqlConnection and System.Data.SqlClient.SqlCommand?

            Using myConnection As SqlConnection = New SqlConnection(connectionString)
                Using myCommand As New SqlCommand(queryCommandString, myConnection)
                    Try
                        ' execute commands

                    Catch ex As Exception

                    End Try
                End Using
            End Using 

Open in new window

0
 

Author Comment

by:PDIS
ID: 41844994
Kyle and funwithdotnet, I noticed not all places where using, using statements.  I took over the code from someone else, and I guess I didn't dig far enough.  Thank out for pointing in the right direction.  I do have a question, that we I search on everyone has a dinner opinion on.
                                                Try
                                                    Using conn As New SqlConnection(My.Settings.connStr)
                                                        Using cmd As New Data.SqlClient.SqlCommand(sqlSalesInsert, conn)
                                                            conn.Open()
                                                            cmd.ExecuteNonQuery()
                                                        End Using
                                                    End Using
                                                Catch ex As Exception
                                                End Try

Open in new window


This method or funs method which is actually better?
0
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 41845854
If you need access the variables inside the using statement then try inside of the using statement is your only option.  (EG: Once you leave the using the variables become out of scope).

If you don't need access to the variables then outside is fine.
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question