title: How to fix 'java.sql.SQLException' error when I insert data in MySQL
body: <p>Im using preparedStatement, and i have java.sql.SQLException error</p>
  
  <pre><code>query = "INSERT INTO instdb (" +
       "id," +
       "name," +
       "username," +
       "descr," +
       "tel," +
       "vk," +
       "ownerId," +
       "query," +
       "postId," +
       "parametr) VALUES" +
       "(?,?,?,?,?,?,?,?,?,?)";
  stmt = con.prepareStatement(query);
  stmt.setInt(1, maxid);
  stmt.setString(2,user.getFull_name());
  stmt.setString(3,username);
  stmt.setString(4,caption);
  stmt.setString(5,longestTel);
  stmt.setString(6,vk);
  stmt.setString(7,ownerId);
  stmt.setString(8,addons.get(j));
  stmt.setString(9,postId);
  stmt.setString(10,param);
  </code></pre>
  
  <p>And on <code>stmt.setInt(1, maxid);</code> error</p>
  
  <pre><code>java.sql.SQLException: Parameter index out of range (1 &gt; number of parameters, which is 0).
  </code></pre>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>I replace <code>stmt = con.prepareStatement(query);</code> and have a new error:</p>
  
  <pre><code>java.sql.SQLSyntaxErrorException: 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 '?,?,?,?,?,?,?,?,?,?)'
  </code></pre>
  
  <p>P.S.
  That didnt help me <a href="https://stackoverflow.com/questions/10896151/java-sql-sqlexception-parameter-index-out-of-range-1-number-of-parameters-wh">stackoverflow</a></p>