Problem: Open Database Connection

Vote:
 

We are  using DatabaseHandler class of StarSuit.Core.Data  for executing stored procedures. We find that the database connections are not getting closed after use.

We made sure our Add/Updates are in transaction which are properly rollbakced and committed.

FYI : We are not putting GetReader calls in transaction. Can this be the reason.

 

This is something of high priority as the system is in production now.

 

Thanks

#21026
Jun 19, 2008 9:52
Vote:
 

Hi Bhavin,

If using a transaction the connection should close on Rollback/Commit.

If not using a transaction the connection should close after the returned DataReader has been closed.

 

Regards,

Håkan 

#21044
Jun 19, 2008 11:57
Vote:
 

Thanks

 

But is the close be handled by databaseHandler or do we need to close mannually. In Case of manual close, we are not seeing any close method in DatabaseHandler class.

below is the refernce code we are using

bool isInTransaction = DatabaseHandler.InTransaction;

if(!isInTransaction)

DatabaseHandler.BeginTransaction();

try 

------execute  sp -----

if(!isInTransaction)

databaseHandler.commit()

}

catch

{

databaseHandler.Rollback();

}

 

#21203
Jun 20, 2008 9:49
Vote:
 

In the example above Commit or Rollback will close the connection.

However, if you use DatabaseHandler.GetReader without any transaction, it is necessary for you to close the returned reader for the connection to be closed.

  

Regards,

Håkan 

#21210
Edited, Jun 23, 2008 8:57
This thread is locked and should be used for reference only. Please use the Legacy add-ons forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.