Fixed pass condition for database tryconnection