Catch SQLException

Catch SQLException or we will have an crash. Also change application
name on couple of places where it has been forgotten before.