title: vb net set timeout period in connection string mysql
body: <p>i have a program that proccess a huge database, it's around 4,8k records.. i'm populating the data into two 2d array, comparing it, then insert the result into database in form of new table..</p>
  
  <p>and i also have two set of database, the smaller one with only 40 records and the biggest one with 4,8k records.. when i tested the smaller database, program runs correctly</p>
  
  <p>but when i'm using the biggest one, the error occured. </p>
  
  <p>i've already try to identified the connection leak, but it turned out that there isn't any.</p>
  
  <p>i've already closed all the connection properly with <code>dispose</code> or <code>close</code></p>
  
  <p>but the first error message was the infamous ** timeout period period. . . max pool size was reached**</p>
  
  <p>later after i dismiss the error message, another error message popped out <code>the connection must be valid and open</code> though i've already re-checked that problem</p>
  
  <p>i'm using vs 2005 and i search to google that this error was the bug that occured in vs 2005, but i couldn't never properly find the solution that microsoft provided</p>
  
  <p>so i'm thinking is there a way to fix this, like modified the connection function. what should i change in my code below?</p>
  
  <pre><code>Imports MySql.Data.MySqlClient
  Public Class koneksi
    Private Conn As MySqlConnection = Nothing
    Public Function konek() As MySqlConnection
       Dim ConnString As String
       ConnString = ";server=localhost;user=root;password=;database=skripsi2;"
       Try
           Conn = New MySqlConnection(ConnString)
           Conn.Open()
  
       Catch ex As Exception
          MessageBox.Show("Koneksi Error " + ex.Message)
       End Try
       Return Conn
    End Function
  
  End Class
  </code></pre>
  
  <p>*<strong>note</strong>: what i've already done yet is set the connection timeout to 0/300. set the pooling to true and give the max pool size = 200</p>
  
  <p>but all that attempt was in vain.. nothing worked..</p>
  
  <p>so could you please tell me how to fix this? i 've worked my brains out over one week and still got no solution for this</p>
  
  <p><strong>i'm using vb.net 2005 and mysql as database</strong></p>
  
  <p>'UPDATE CODE EXAMPLE CALLING THE CONNECTION FUNCTION</p>
  
  <pre><code>            Dim resnode1 As String = "..."
              CMD_resnode = New MySqlCommand(resnode1, conn.konek)
              resnode = CMD_resnode.ExecuteReader()
  
              Dim getmaxrow2 As String = "..."
              CMD_maxrow2 = New MySqlCommand(getmaxrow2, conn.konek)
              maxrow2 = Convert.ToInt32(CMD_maxrow2.ExecuteScalar())
              CMD_maxrow2.Connection.Dispose()
  
              maxrow22 = maxrow2 - 1
  
              IF....THEN
              ....
              resnode.read()
              ....
              END IF
  
              CMD_resnode.connection.dispose()
  </code></pre>