Well, always reconnecting to a database is not really good. This doesn't only slow down things but also isn't really convenient. Instead use one instance of the connection and only if it times out, reconnect. I haven't looked at your code that much but putting updating statements in a async task will also increase performance.