How do I use the pooling features?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
tabsautobiz
Posts: 5
Joined: Wed 08 Jun 2011 18:33

How do I use the pooling features?

Post by tabsautobiz » Wed 22 Jun 2011 21:46

I'm currently creating a wcf service that will perform frequent selects on a database.

Currently I'm looking at something like this:

Code: Select all

Public Function GetInfo() as string
    Dim connection As New PgSqlConnection(connectionString)
    connection.Open()
    Dim command As New PgSqlCommand("SELECT * FROM TABLE", connection)
    Dim reader As PgSqlDataReader = command.ExecuteReader
    While reader.Read
      'do something with the data
    End While
    connection.Close()
    Return "Done"
End Function
Would this code transparently use the built-in connection pooling, or do I need to use a different approach?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 23 Jun 2011 07:08

Usage of the connection pooling depends on the Pooling connection string parameter. The default value: Pooling=true.
For more information, please refer to http://www.devart.com/dotconnect/postgr ... Q.html#q54.

Post Reply