Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Do you check connection on every call to SQL?
Message
 
 
À
10/03/2012 09:44:09
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01537347
Message ID:
01537919
Vues:
27
>>>>Hi,
>>>>
>>>>My application creates one SQL Server connection at the top of the application and then relies on it for all calls to SQL Server. But I understand that the connection can time out. Therefore, do you recommend that the program checks if the connection is still valid (by e.g. by SELECT CAST(1 as BIT) or some other way) every time the program needs to connect (to SQL Select or Update)? TIA.
>>>
>>>There's no point. If the connection is *down* then it doesn't matter whether the SQL is simple or complex - it will fail immediately.
>>>And if it is *up* there is no quarantee that it will not go down whilst the query is executing anyway.....
>>>
>>>Of course, if, as suggested, you switch to closing and re-opening connections it's not relevant anyway.
>>>
>>>>UPDATE. An idea just occurred to me. What if on every call to the SQL Server I store the time of the call to the application property. Then, every time another call needs to be made, the code would check how much time elapsed since the last call. Then if the time is greater than the set Time Out, create new connection, otherwise, use existing.
>>>>Does it make sense? Is it practical?
>>
>>Maybe I was crazy but I thought that I was posting my initial question in this thread in either VFP or SQL Server forum. And now I see that it is in the .NET forum. Which is good in many ways. I have learned the concept of Pooled Connection which I am now applying to my ASP.NET application.
>>But my VFP application cannot use Pooled Connections so I need a good approach there. Which is my case just open connection at the top and maintain it. Typically my installation has no more than 20 users so I suppose at most it occupies 20 connections.
>>And my idea of checking the time between the last connection would be for VFP only. That is, if one of these 20 users goes to 3-hour lunch and comes back and expects the program to work right off the bet, I need to have a way to prevent the error. This is where I thought that if the program "logs" the last connection time stamp it (the application) would check it. And if the time elapsed is greater than the set Time Out, the application would create a new connection. Again, this is for VFP not ASP.NET.
>
>OK. If .NET doesn't come into it then neither does pooling. But if it is .NET then connection pooling (AFAIK) applies to VFPOLEDB...

I have been using the VFPOLEDB connection with ASP.NET for 5 years and I wonder if any way my app was benefitting from the connection pooling. At least with SQL Server I found an online article that has a little demo of how to "check" the connection pooling. Which I plan to do (I mean to check how it works).
Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform