In my application to connect to Orace database I always create a new connection, open it, execute OracleCommands and finally close it afterwards. Recently I thought implemen
In general, no, you shouldn't use a single connection - all of the .NET ADO.NET providers support connection pooling, and the normal pattern is to open/close connections as you need them (in a using
or try/finally
block to ensure the connection is closed in the event of an exception).
In a single-threaded client application you could get away with using a shared static connection, but it's unlikely to give you any measurable performance benefit - so don't do it.
In any other application, you definitely shouldn't use a shared static connection, as it is not thread-safe.