Stop trytond if an exception occurs while connecting to a database

issue4066
review14391002