I have a report window that displays the results returned from a potentially long oracle stored procedure. My problem is when the user closes the window, the connection to the oracle remains open, and the potentially long running report is not canceled.
The only way to close an open connection is for database administrators to kill them manually, or to exit the entire application.
I tried calling Closeon a connection from another thread, but this seems to be continuously blocked. I also tried to cancel the transaction, but this shows the same problem.
I am worried that the only solution would be to start the request in another process (or perhaps in the application domain?).
It is likely that I am missing something obvious, any help would be greatly appreciated.
READ PLEASE
This question does not concern the transfer of my connection to the operator using. It is about how to force an oracle connection that executes a request to close.
Example:
- Run the thread executing the request
- Copy the connection object somewhere
Click on the connection object
public void Go()
{
OracleConnection connection;
var queryThread = new Thread(
() =>
{
using (connection = OpenOracleConnection())
{
}
});
Thread.Sleep(3000);
var closeThread = new Thread(
() =>
{
connection.Close();
});
closeThread.Start();
}
The problem is that this does not close the connection; instead, calling connection.Close () blocks the execution of the procedure.
source
share