title: Error in your MySQL SQL syntax
body: <p>I'am trying to insert a record in my MySQL database, the record should be inserted in table <code>medication_profile</code>,  but I get this error that says :</p>
  
  <blockquote>
    <p>Exception in thread "main"
    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 
        You have an error in your SQL syntax; check the manual that 
        corresponds to your MySQL server version for the right syntax to use near 
        ' medication_type, diabetic_id, times_a_day, dose) VALUES ('injections',2,1,'18')' 
        at line 1</p>
  </blockquote>
  
  <p>The code I'am using in java to insert this record is as follow:</p>
  
  <pre><code>PreparedStatement addMedicationStm = con.prepareStatement("INSERT INTO medication_profile"
              + ", medication_type, diabetic_id, times_a_day, dose) "
              + "VALUES (?,?,?,?))", Statement.RETURN_GENERATED_KEYS);
      addMedicationStm.setString(1, medication.getMedicationType());
      addMedicationStm.setInt(2, medication.getDiabeticID());
      addMedicationStm.setInt(3, medication.getTimesPerDay());
      addMedicationStm.setString(4, medication.getDose());
      addMedicationStm.executeUpdate();
  
      ResultSet rs = addMedicationStm.getGeneratedKeys();
  
      if (rs != null &amp;&amp; rs.next()) {
          medication.setDiabeticID(rs.getInt(1));
          addMedicationStm.close();
          con.close();
      }
  </code></pre>
  
  <p>I can't find where the error is, as I see the insert syntax is correct</p>
  
  <p>any suggestions?</p>
  
  <p>thanks in advance</p>