public static BufferedReader queryCDD (String dataType, String query) throws Exception {
		URL url = new URL(CDD_BATCH_URL);
		String queryString = CDD_BATCH_QUERY+"&tdata="+dataType+query;
		// System.out.println("Querying "+CDD_BATCH_URL+" with query: \n-->"+queryString);
		HttpURLConnection con = (HttpURLConnection) url.openConnection();

		con.setDoOutput(true);
		con.setDoInput(true);
		con.setRequestMethod("POST");

		DataOutputStream wr = new DataOutputStream(con.getOutputStream());
		wr.writeBytes(queryString);
		wr.flush();
		wr.close();

		int status = -1;
		String cdsid = null;
		BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
		String line;
		while ((line = in.readLine()) != null) {
			String[] record = line.split("\\s");
			// if (record[0].equals("#status")) status = Integer.parseInt(record[1]);
			if (record[0].equals("#cdsid")) cdsid = record[1];
		}
		in.close();

		// System.out.println("cdsid = "+cdsid);

		while (status != 0) {
			Thread.sleep(500);
			url = new URL(CDD_BATCH_URL+"?cdsid="+cdsid);
			con = (HttpURLConnection) url.openConnection();
			con.setDoInput(true);
			in = new BufferedReader(new InputStreamReader(con.getInputStream()));
			while ((line = in.readLine()) != null) {
				String[] record = line.split("\\s");
				try {
					if (record[0].equals("#status"))
						status = Integer.parseInt(record[1]);
				} catch (NumberFormatException e) {}
				if (status == 0) break;
			}
			if (status != 0) in.close();
		}
		return in;
	}