Environment versions
Database:
Jet/Access Engine
Testing shows that, by default, pooling is not enabled for the JET provider. Try adding 'OLE DB Services=-1' to your connection string.
See elsewhere in this thread for the performance improvement I see......
>Thanks Bill....
>
>But if pooling were active, there should not be such a drop in performance, right?
>
>In fact from what I understand, Microsoft.Jet.OLEDB.4.0 does not support pooling, which might be my problem.
>
>Have not been able to find an explicit statement somewhere that confirms that, but from my registry settings, that is what I conclude.
>
>In fact, I read somewhere that it is recommended to have one connection per client, which kind of contradicts the pooling concept.
>
>It might be that pooling only makes sense on a true dbms like sqlserver, unlike an access file that is merely shared.
>
>It's not such a big deal in itself, but it might be documented a bit more clearly, then I would not have to redesign my dataaccess classes :)
>
>
>
>
>>You're opening and closing conn inside the for loop in the second one.
>>That will hit performance.
>>Move them outside the for loop and try it.
>>
>>
>>>>
>>Check out the following tests
>>Testconnections2 returned 0.23 seconds, Testconnections3 returned 4.68 seconds, that's a factor of 20 slower. If there is any pooling done here, it's either not working for me, or it's kind of not very effective.
>>What am I missing?
>>
>> Public Sub testConnections2()
>> Dim cmd As New OleDbCommand
>> Dim da As New OleDbDataAdapter(cmd)
>> Dim conn As New OleDbConnection
>> Dim dt As New DataTable
>> conn.ConnectionString = My.Settings.b040_beConnectionString
>> conn.Open()
>> cmd.Connection = conn
>> Dim n As Long
>> Dim t As Date = Now
>> For i As Integer = 1 To 100
>> cmd.CommandText = "select Art_id from Artikel where Art_nr = ' 125'"
>> n = cmd.ExecuteScalar()
>> cmd.CommandText = "select * from artikel where Art_Nr = ' 125'"
>> da.Fill(dt)
>> Next
>> Debug.Print((Now() - t).ToString)
>> End Sub
>> Public Sub testConnections3()
>> Dim cmd As New OleDbCommand
>> Dim da As New OleDbDataAdapter(cmd)
>> Dim conn As New OleDbConnection
>> Dim dt As New DataTable
>> conn.ConnectionString = My.Settings.b040_beConnectionString
>> cmd.Connection = conn
>> Dim n As Long
>> Dim t As Date = Now
>> For i As Integer = 1 To 100
>> conn.Open()
>> cmd.CommandText = "select Art_id from Artikel where Art_nr = ' 125'"
>> n = cmd.ExecuteScalar()
>> cmd.CommandText = "select * from artikel where Art_Nr = ' 125'"
>> da.Fill(dt)
>> conn.Close()
>> Next
>> Debug.Print((Now() - t).ToString)
>> End Sub
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only