How do I use the pooling features?
Posted: 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:
Would this code transparently use the built-in connection pooling, or do I need to use a different approach?
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