code: public static void verify(DataSource ds) throws SQLException {
          Connection conn = null;
          try {
              // get a connection -- this will test the connection works
              conn = ds.getConnection();
          } finally {
              JdbcUtil.close(conn);
          }
      }
docs: Verifies a DataSource is functional.  This method will call getConnection()
  on the DataSource and if that fails a SQLException will be thrown.
  @param ds The DataSource to verify
  @throws java.sql.SQLException Thrown if the call to getConnection() fails
  to obtain a SQL connection.