Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Maintaining connection to SQL Server or not?
Message
 
À
22/06/2005 15:06:17
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, États-Unis
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
01025474
Message ID:
01025590
Vues:
15
At first I thought of doing something like that but my applications run mostly on MSDE and then I'd only have 5 concurrent connections. Connecting/Disconecting I can have more users using the application at the same time.

>Dmitry,
>
>I created a connection object that manages the connection. I connect to the database on startup and then leave it connected. I only use one connection unless I need to have a second connection to bypass a transaction for example. My connection object manages errors so if the connection times out, I will automatically reconnect and the user sees nothing. The only exception to this is a 24-7 application that is an unmanned weigh station. In that case I connect when the trucker starts a weight ticket and then disconnect when the trucker is finished.
>
>>Do you happened to have a form, like a Customer File form or something like that, with navigating buttons (Next/Previous)? If so, how do you deal with database connection in this form (again, if you have such a thing).
>>
>>Thank you.
>>
>>>I open the connection and leave it open until I've download/upload all the data I need from the server, then I close it. with this method connectiing time is not an issue (at least not for me).
>>>
>>>>Dmitry,
>>>>It is true that it takes a long time to connect ( I like the way they have "solved" this in .NET with the connection pool). I will follow this thread to see what other developers think, because I am interested in their response too.
>>>>
>>>>Einar
>>>>
>>>>>Einar,
>>>>>I am using VFP 9. I have read it too (in some articles in CODE magazine) that this (connect and quickly disconnect) is suggested method.
>>>>>But I am wondering about how practical it would be in a VFP application. I am concerned that this approach will be too slow (or maybe not), this is why I am asking for someone to share their practical experience.
>>>>>
>>>>>>Dmitry,
>>>>>>What language are you using?
>>>>>>The new way of doing things (according to M$ and ADO.NET) you should connect, get your data into a DataSet (or cursor or whatever) and then disconnect.
>>>>>>Einar
>>>>>>
>>>>>>>I am making baby steps in creating a simple (test) form using n-tier approach. UI -> BO -> DA. That is, UI through BO asks DA for a record and displays it. As user navigates through records in the table, the cycle "UI->BO->DA" will be done quite often (possibly). The DA is where connection to SQL Server takes place.
>>>>>>>
>>>>>>>Should I close the connection and open a new one on every call to DA or should I make the connection PUBLIC and maintain it for duration of the form being open?
>>>>>>>
>>>>>>>Thank you for any suggestions.
I'm a mixture of Albert Einstein and Arnold Schwarzenegger. The only trouble is that I got Einstein's body and Schwarzenegger's brain
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform