Rename mysql cursor so it doesn't look like connection
Ping database connection before attempting query