@Override
 public void dispose() {
   try {
     if (connection != null) connection.close();
   } catch (Exception e) {
     e.printStackTrace();
     if (log.isErrorEnabled()) log.error("Error while closing the connection.", e);
   }
 }
 @Override
 public void test() throws JRException {
   try {
     if (connection != null) {
     } else {
       createConnection();
     }
     connection.test();
   } finally {
     dispose();
   }
 }