Best practices for using Connections in connected environment?

M

Michael Russell

Hi all,

I'd be interested in hearing opinions for best practices regarding
handling data connection in a connected (desktop client/server)
application environment. I'm working with the assumption that the
database (driver/component/etc.) supports pooling. I'm currently
working on an MDI app that in which the user will potentially be looking
at/editing data from many different datasets for the better part of the day.

In the past, I've only worked in disconnected/web environments, so the
idea has been to drop the connection as quickly as possible to return it
to the pool.

My guess here is to use a single connection per application instance,
and for each class that needs a connection let them share with one
another.

Thanks,
Michael
 
G

Guest

I would continue to code as you did before (create-connect, use,
close-destroy). When your code creates a new connection it will be getting
one immediately from the system that was already open. The actual database
connection between the machine and the server will be pooled(kept open) by
the system for the duration of the inactivity timeout. If your application
needs more than one open at a time it will be created but in a client-server
application you will seldom require more than one.
 
C

Cor Ligthert [MVP]

Terence,

The same as Michael, do it in the same way as you was used in an ASPNET
applicication.

(You know that for a dataadapter or a tableadapter don't even have to open
and close the connection? That is done in the adapter).

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top