Article Details
Id:12829
Product:finPOWER Connect
Type:NEW
Version:2.03.00
Opened:21/04/2015
Closed:22/04/2015
Released:09/07/2015
Job: J015321
High Importance

Database connection handling; various enhancements

Database connection handling and recovery has been enhanced. Previously, if finPOWER Connect lost its connection to the database, eg the wi-fi dropped out, it would undoubtably causes a unrecoverable error at some point.

Changes have been made to the finPOWER Connect Business Layer to improve database connection handling by automatically attempting to re-connect to the database when required.

A new function "IsConnectionAlive" has been added to finBL.Database. This returns False if the database connection has not been initialised or has been lost for some reason. Note, depending on the database provider the result may not be 100% accurate.

The finBL.Database.TransactionBegin method is now a function and returns True or False depending on whether or not the function is successful. For Access Databases this will normally always return True. For SQL Server databases this will return False if the Database Transaction Begin failed.

Use the following code template when incorporating Database Transactions.

If finBL.Database.TransactionBegin() Then
  ' Do work

  If Main Then
    finBL.Database.TransactionCommit()
  Else
    finBL.Database.TransactionRollback()
  End If
Else
  Main = False
End If

In addition, the Error message form now uses "IsConnectionAlive" function. If False the SQL Server version and current date/ time information is not retrieved - as it is assumed the connection is down and this will just generate more errors.

Note, there is more work to be down in this area, but this lays the foundations for the future.