Added try catch to mysql connection