add ping() for mysql, mysqli and pdo to ensure db connection available while doing query

add ping() for mysql, mysqli and pdo to ensure db connection available while doing query