Click here to Skip to main content
14,693,821 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
String strcon = @"server=localhost;user id=root;password=root;database=mdagree;persistsecurityinfo=True;Connect Timeout=500";
                con = new MySqlConnection(strcon);
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                    con.Open();
                }
                else
                    con.Open();

Hi,i'm working in c# windows application with mysql database for small Automation(Automatic MySQL database insertion)application.

To do this task i need a MySQL Connection. i'm using the above code for MySQL connection this works well but most of the time it produces error like
Quote:
" Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.; "
when this error occured my MySQL connection get disconnected.
Posted
Updated 5-May-15 4:58am
v4

1 solution

Increase the timeout for those commands where you are getting an error with cmd.CommandTimeout = 900 etc.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900