Re: VB.NET - Desktop App - DB Connections

From: Cablewizard (Cablewizard_at_Yahoo.com)
Date: 08/05/04


Date: Thu, 5 Aug 2004 13:12:42 -0600

In my opinion it would depend on usage.
If the app is constantly hitting the database, leave the connection open.
If you are just querying out some stuff in the beginning and not going back to
it regularly, I would close it.
Of course if you want to keep the recordset open, then might need to keep it
open.
Connecting and disconnecting can sometimes take a little while (seconds), but if
it has to be re-established often, then this can annoy the users.
Additionally, depending upon your configuration, your server might have a time
out, and after a period of inactivity it might disconnect you anyway, in which
case you might get a run-time error if you think it should be open. Don't see
this too often with SQL, but pops up with Oracle a lot.

I have apps that use both methods.
Opening and keeping open is the "easy" and sometimes lazy way.
But like I said, the "right" choice depends on what you are doing.

Gerald

"Leo J. Hart IV" <leo.hart@fmr.com> wrote in message
news:b6bda431.0408050947.7ee6efd@posting.google.com...
> Hello,
>
> I come from a mostly web application background, but am currently working on
> a desktop app to be designed using VB.NET. The app will have around 15
> users; I don't expect that amount to increase significantly.
>
> I'm trying to decide on which approach to use in regards to database
> connection handling. Should I open my database connection (to SQL Server)
> on application startup and hold it for the user's entire session (meaning
> that each user will have 1 dedicated DB connection) or do I go with the
> approach I'm more familiar with using on web apps where you open and close
> DB connections as you need them.
>
> Most of the guys here are telling me that the first approach is generally
> how it's done on client server apps with a small amount of users, but once
> again, given my background, I feel a bit uncomfortable with that route.
>
> Any advice from you experience windows programmers out there?
>
> Thanks,
> Leo



Relevant Pages

  • Re: ADO Connection Timeout
    ... to the central server, but you are willing to live with periods where it ... i.e. a local database or even a text file. ... to function until the connection can be restored to the server. ...
    (microsoft.public.data.ado)
  • Complicated Connection Problems bewteen ADP and SQL Server
    ... This database ... expertise for getting the user workstations talking to the SQL Server. ... connection would fail and the adp wouldn't be able to talk to the server. ... might be in my ADO connection string. ...
    (microsoft.public.access.adp.sqlserver)
  • Complicated Connection Problem between ADP and SQL Server
    ... This database ... expertise for getting the user workstations talking to the SQL Server. ... connection would fail and the adp wouldn't be able to talk to the server. ... might be in my ADO connection string. ...
    (microsoft.public.sqlserver.connect)
  • Re: ADO Connection Timeout
    ... so what happens when a connection failure forces one station to revert ... to a local database? ... Further, you *will* have contention issues, Jet does not support record ... to the central server, but you are willing to live with periods where it ...
    (microsoft.public.data.ado)
  • Re: ADO Connection Timeout
    ... When the first test is run, the results are stored in the central database. ... to the central server, but you are willing to live with periods where it ... i.e. a local database or even a text file. ... to function until the connection can be restored to the server. ...
    (microsoft.public.data.ado)

Loading