title: connection to Pervasive database slow
body: <p>This has been an on going issue at my place of work.  Previously, we had a co-op programming student write us some applications using C# which ran well on his laptop, but once the applications were put to use on different computers, the connection to the pervasive database because painfully slow.</p>
  
  <p>Now I am writing a simple VB.net application which need to query the Pervasive database, and I'm running into the same issue.</p>
  
  <p>here's my code:</p>
  
  <pre><code> 'PSQL variables
          Dim myPsqlConnection As PsqlConnection = New PsqlConnection("ServerName=FILESERVER;ServerDSN=SAGE2")
          Dim queryString As String
          queryString = "SELECT NAME FROM CUSTOMER"
          Dim MyCommand As New PsqlCommand(queryString, myPsqlConnection)
          Dim MyReader As PsqlDataReader
          Dim tempCustname As String
  
  
          Try 'open conncetion to Pervasive DB
              myPsqlConnection.Open()
          Catch ex As Exception
              MsgBox("COULD NOT OPEN A CONNECTION TO THE DATABASE" &amp; vbCrLf &amp; ex.Message)
              Exit Sub
          End Try
  
          Try 'execute Pervasive query
              MyReader = MyCommand.ExecuteReader
          Catch ex As Exception
              MsgBox("QUERY ERROR" &amp; vbCrLf &amp; ex.Message)
              Exit Sub
          End Try
          If MyReader.HasRows = False Then
              MsgBox("NO RESULTS FOUND")
              Exit Sub
          End If
          While (MyReader.Read)
              tempCustname = MyReader("NAME").ToString()
              Customers.Items.Add(tempCustname)
          End While
          MyReader.Close()
          myPsqlConnection.Close()
  </code></pre>
  
  <p>I stepped through the program and it take about 30 seconds to get past the line where it opens the connection.</p>
  
  <p>As for the specs (I'll do my best):</p>
  
  <p>My computer is quite powerful (16 gb or ram, 6 core AMD processor at 3.0 Ghz per core, windows 7 home 64 bit)</p>
  
  <p>Pervasive.Data.SqlClient Version 3.2</p>
  
  <p>Compiling with Microsoft Visual Basic 2010 Express</p>
  
  <p>There are very few computers on this network (about 7), and I have no such trouble with MS Access databases.  Our server is new 2 years ago, and out network has been upgraded to a GB connection.  I should note I know very little about databases in general, let alone connecting with VB.  I'm not really the best person to be doing this, but I'm still the most qualified person in our small company.</p>