Skip to main content

HI,

We have a C# WCF Service that opens a Database Connection and begins a transaction when a request to one of the available web methods is made. After this connection is opened and the transaction has begun, we make a call to a COBOL Module that performs some common functionality with a database connection. This call is performed through a Wrapper that creates a RunUnit similarly as described in this forum post: https://community.rocketsoftware.com/discussion/rununit-recommended-approach-with-wrapper#bm01394414-3974-4f15-8877-465354def492 .

The Wrapper passes our SQL Connection and Transaction to the RunUnit which uses the following to bind our database connection:

EXEC ADO
BIND CONNECTION TO :DBconn WITH TRANSACTION :DBtran
END-EXEC

The COBOL module is then called and functions as intended. The very last step of the Wrapper, we issue StopRun() on our RunUnit to free any resources. We'd then continue on with our web method, making further database updates/selects etc. 

We've recently upgraded from Microfocus COBOL server 2.3 to Microfocus COBOL Server 8. 
This was all working fine prior to the upgrade. However, since upgrading, we've noticed that the StopRun() command is actually closing our connection (uncertain as to what it is doing with the transaction but I suspect it's probably rolling back).

We're wondering if this was an intended change to the functionality of StopRun(), and based on the above context, should we perhaps be using something else in place of StopRun()?

One of the guys has identified that issuing an UNBIND CONNECTION prior to issuing the StopRun() seems to resolve the problem, but we're yet to do a formal test. 

Thanks,

Alex

HI,

We have a C# WCF Service that opens a Database Connection and begins a transaction when a request to one of the available web methods is made. After this connection is opened and the transaction has begun, we make a call to a COBOL Module that performs some common functionality with a database connection. This call is performed through a Wrapper that creates a RunUnit similarly as described in this forum post: https://community.rocketsoftware.com/discussion/rununit-recommended-approach-with-wrapper#bm01394414-3974-4f15-8877-465354def492 .

The Wrapper passes our SQL Connection and Transaction to the RunUnit which uses the following to bind our database connection:

EXEC ADO
BIND CONNECTION TO :DBconn WITH TRANSACTION :DBtran
END-EXEC

The COBOL module is then called and functions as intended. The very last step of the Wrapper, we issue StopRun() on our RunUnit to free any resources. We'd then continue on with our web method, making further database updates/selects etc. 

We've recently upgraded from Microfocus COBOL server 2.3 to Microfocus COBOL Server 8. 
This was all working fine prior to the upgrade. However, since upgrading, we've noticed that the StopRun() command is actually closing our connection (uncertain as to what it is doing with the transaction but I suspect it's probably rolling back).

We're wondering if this was an intended change to the functionality of StopRun(), and based on the above context, should we perhaps be using something else in place of StopRun()?

One of the guys has identified that issuing an UNBIND CONNECTION prior to issuing the StopRun() seems to resolve the problem, but we're yet to do a formal test. 

Thanks,

Alex

Hi Alex,

The way it is working now is correct and using UNBIND CONNECTION is the workaround.

During the StopRun, the OpenESQL runtime tries to clean itself up and kills all the connections associated with the RunUnit.

If UNBIND CONNECTION is executed before StopRun, the connection would be disassociated before the OpenESQL runtime cleanup is done.

It is doing the correct thing as internally, the runtime doesn't differentiate a bound connection and an explicitly opened connection. Therefore, at StopRun time, all connections (including the bound ones) are closed and cleaned.