PC Review


Reply
Thread Tools Rate Thread

Closing a connection BEFORe command execution has completed

 
 
=?Utf-8?B?QW1pciBUb2hpZGk=?=
Guest
Posts: n/a
 
      5th Nov 2007
Hi

What happens in the above scenario? Does the query still continue executing
on the Databas server or is it immmediately terminated and resources released
(including locks).

If this is not recommended, then what is the recommended approach for
terminating command's execution.

Thanks in advance
 
Reply With Quote
 
 
 
 
William \(Bill\) Vaughn
Guest
Posts: n/a
 
      5th Nov 2007
Actually, closing the connection with Connection.Close does not close the
connection--it simply releases it back to the pool so the engine will
continue to fill the cache--but it's not that large so the operation might
simply hang resources on the server until the connection is reused.

The problem is, since all of the (normal) Execute methods are synchronous,
there is no way to interrupt the query or action command process. The
solution you seek can only be accomplished by running the query
asynchronously. While waiting for the query to complete you can execute
Command.Cancel. Because of the way TDS and SQL Server responds to cancel
requests your operation might not be immediately "stoppable"--SQL Server
might have some cleanup to do before releasing control and resources.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
"Amir Tohidi" <(E-Mail Removed)> wrote in message
news:4C0F7B92-18AC-4D6F-A7EB-(E-Mail Removed)...
> Hi
>
> What happens in the above scenario? Does the query still continue
> executing
> on the Databas server or is it immmediately terminated and resources
> released
> (including locks).
>
> If this is not recommended, then what is the recommended approach for
> terminating command's execution.
>
> Thanks in advance


 
Reply With Quote
 
=?Utf-8?B?QW1pciBUb2hpZGk=?=
Guest
Posts: n/a
 
      6th Nov 2007
Thanks Bill

Your suggestion is supported for SQL Server; unfortunately, I am using
Oracle and the OracleCommand does not (even the ODP one) does not support
asynch calls.

Do you have any other suggestions please?

"William (Bill) Vaughn" wrote:

> Actually, closing the connection with Connection.Close does not close the
> connection--it simply releases it back to the pool so the engine will
> continue to fill the cache--but it's not that large so the operation might
> simply hang resources on the server until the connection is reused.
>
> The problem is, since all of the (normal) Execute methods are synchronous,
> there is no way to interrupt the query or action command process. The
> solution you seek can only be accomplished by running the query
> asynchronously. While waiting for the query to complete you can execute
> Command.Cancel. Because of the way TDS and SQL Server responds to cancel
> requests your operation might not be immediately "stoppable"--SQL Server
> might have some cleanup to do before releasing control and resources.
>
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant
> Microsoft MVP
> INETA Speaker
> www.betav.com/blog/billva
> www.betav.com
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no rights.
> __________________________________
> Visit www.hitchhikerguides.net to get more information on my latest book:
> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
> and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
> -----------------------------------------------------------------------------------------------------------------------
> "Amir Tohidi" <(E-Mail Removed)> wrote in message
> news:4C0F7B92-18AC-4D6F-A7EB-(E-Mail Removed)...
> > Hi
> >
> > What happens in the above scenario? Does the query still continue
> > executing
> > on the Databas server or is it immmediately terminated and resources
> > released
> > (including locks).
> >
> > If this is not recommended, then what is the recommended approach for
> > terminating command's execution.
> >
> > Thanks in advance

>

 
Reply With Quote
 
William Vaughn
Guest
Posts: n/a
 
      8th Nov 2007
Sorry, no. I don't use, support or have any inside knowledge about Oracle.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

"Amir Tohidi" <(E-Mail Removed)> wrote in message
news:97D3F259-665B-4A9A-8BFE-(E-Mail Removed)...
> Thanks Bill
>
> Your suggestion is supported for SQL Server; unfortunately, I am using
> Oracle and the OracleCommand does not (even the ODP one) does not support
> asynch calls.
>
> Do you have any other suggestions please?
>
> "William (Bill) Vaughn" wrote:
>
>> Actually, closing the connection with Connection.Close does not close the
>> connection--it simply releases it back to the pool so the engine will
>> continue to fill the cache--but it's not that large so the operation
>> might
>> simply hang resources on the server until the connection is reused.
>>
>> The problem is, since all of the (normal) Execute methods are
>> synchronous,
>> there is no way to interrupt the query or action command process. The
>> solution you seek can only be accomplished by running the query
>> asynchronously. While waiting for the query to complete you can execute
>> Command.Cancel. Because of the way TDS and SQL Server responds to cancel
>> requests your operation might not be immediately "stoppable"--SQL Server
>> might have some cleanup to do before releasing control and resources.
>>
>> --
>> ____________________________________
>> William (Bill) Vaughn
>> Author, Mentor, Consultant
>> Microsoft MVP
>> INETA Speaker
>> www.betav.com/blog/billva
>> www.betav.com
>> Please reply only to the newsgroup so that others can benefit.
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> __________________________________
>> Visit www.hitchhikerguides.net to get more information on my latest book:
>> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
>> and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
>> -----------------------------------------------------------------------------------------------------------------------
>> "Amir Tohidi" <(E-Mail Removed)> wrote in message
>> news:4C0F7B92-18AC-4D6F-A7EB-(E-Mail Removed)...
>> > Hi
>> >
>> > What happens in the above scenario? Does the query still continue
>> > executing
>> > on the Databas server or is it immmediately terminated and resources
>> > released
>> > (including locks).
>> >
>> > If this is not recommended, then what is the recommended approach for
>> > terminating command's execution.
>> >
>> > Thanks in advance

>>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Data Execution Prevention keeps closing IE8 Robert Aldwinckle Windows Vista Performance 1 27th Jul 2009 01:51 AM
RE: Halt code execution when closing form NetworkTrade Microsoft Access Form Coding 0 13th Oct 2008 09:27 PM
How do you stop the "Command Prompt Box" from auto closing after program execution? Nightbreaker Windows XP New Users 3 20th Jan 2006 01:19 AM
Re: How to insert a field that must be completed before closing word Jezebel Microsoft Word Document Management 0 2nd Sep 2005 10:17 AM
To Know bat file, execution is completed using VB.NET =?Utf-8?B?TXVzdGFx?= Microsoft Dot NET 1 23rd Jun 2005 09:05 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:40 PM.