title: Pool with MySQL and ASP.NET MVC
body: <p>I am developing a web application with ASP.NET and MySQL, but I am not using the SqlClient provider.</p>
  
  <p>I read somewhere (I do not remember where) that if I need to establish a connection pool I need to add some lines to file <code>web.config</code>.</p>
  
  <p>To make a connection, defined in each model there is a connection string, something like:</p>
  
  <pre><code>string sqlConnection = 
      "server=localhost; user id=root; password=***; database=test; pooling=true;Min Pool Size=0; Max Pool Size=60;";
  </code></pre>
  
  <p>And to connect and do query I do the following:</p>
  
  <pre><code>MySqlConnection conection;
  conection = new MySqlConnection(sqlConnection);
  string query = "SELECT COUNT(*) FROM documents WHERE user_id = ?user_id;
  MySqlCommand cmd = new MySqlCommand(query, conection);`
  
  cmd.Connection.Open();
  cmd.Prepare();
  cmd.Parameters.Add("?user_id", userID);
  cmd.ExecuteReader();
  ...
  cmd.Connection.Close();
  </code></pre>
  
  <p>But I want to open a connection pool and use pooled connections, I do not want to open and close a connection every time.</p>
  
  <p>I put this in the <code>web.config</code> file:</p>
  
  <pre><code>&lt;connectionStrings&gt;
      &lt;remove name="LocalMySqlServer"/&gt;
      &lt;add name="LocalMySqlServer" 
           connectionString="Data Source=localhost; userid=root;  password=***; database=test; Pooling=true; Min Pool Size=50; Max Pool Size=100;"  
           providerName="MySql.Data.MySqlClient"/&gt;
  &lt;/connectionStrings&gt;
  </code></pre>
  
  <p>But when I start the development server, I do not see any connections in <a href="http://en.wikipedia.org/wiki/MySQL_Workbench" rel="nofollow">MySQL Workbench</a>. </p>
  
  <p>This only happens when I call the model and open a connection.</p>
  
  <p>What is the way to have connection pooling at startup time?</p>