title: How to update multiple columns using PreparedStatement in Java - JDBC
body: <p>I want to update multiple columns data in my MySQL database with Java application through using PreparedStatement but I could not figure out how to do it. </p>
  
  <p><strong>Here is the code query for  updating:</strong></p>
  
  <pre><code>String s = "UPDATE items SET name =" + u.getName() + ",category="
                  + u.getCategory() + ", price=" + u.getPrice()
                  + "   ,qunatity=" + u.getQuantity() + " WHERE id = '"
                  + u.getId() + "'; ";
  </code></pre>