public static boolean updateDrug(Connection con, JSONObject parameters) {

		String idS = (String) parameters.get("id");

		if (idS == null)
			return false;

		int id = Integer.valueOf(idS);

		String msdcodeS = (String) parameters.get("msdcode");
		String category_idS = (String) parameters.get("category_id");
		String med_name = (String) parameters.get("med_name");
		String common_name = (String) parameters.get("common_name");
		String unit = (String) parameters.get("unit");
		String unit_details = (String) parameters.get("unit_details");
		String unit_priceS = String.valueOf(parameters.get("unit_price"));

		try {
			int p = 1;
			if (msdcodeS != null)
				updateDrugStatement.setInt(p++, Integer.valueOf(msdcodeS));
			else
				updateDrugStatement.setNull(p++, Types.INTEGER);

			if (category_idS != null)
				updateDrugStatement.setInt(p++, Integer.valueOf(category_idS));
			else
				updateDrugStatement.setNull(p++, Types.INTEGER);

			if (med_name != null)
				updateDrugStatement.setString(p++, med_name);
			else
				updateDrugStatement.setNull(p++, Types.VARCHAR);

			if (common_name != null)
				updateDrugStatement.setString(p++, common_name);
			else
				updateDrugStatement.setNull(p++, Types.VARCHAR);

			if (unit != null)
				updateDrugStatement.setString(p++, unit);
			else
				updateDrugStatement.setNull(p++, Types.VARCHAR);

			if (unit_details != null)
				updateDrugStatement.setString(p++, unit_details);
			else
				updateDrugStatement.setNull(p++, Types.VARCHAR);

			if (unit_priceS != null)
				updateDrugStatement.setDouble(p++, Double.valueOf(unit_priceS));
			else
				updateDrugStatement.setNull(p++, Types.DOUBLE);

			updateDrugStatement.setInt(p++, id);

			System.out.println(updateDrugStatement.toString());

			int result = updateDrugStatement.executeUpdate();

			return result > 0;

		} catch (SQLException e) {
			e.printStackTrace();
		}
		return false;
	}