Added transaction support to database connections.
Better database connection error handling