title: java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0). While using PreparedStatement
body: <p>Using preparedStatement in Java/MariaDb as in the following function</p>
  
  <pre><code>public ArrayList&lt;String&gt; findPath(String roomName) throws SQLException, IOException, InstantiationException, IllegalAccessException, ClassNotFoundException
  {
      ArrayList&lt;String&gt; path = new ArrayList&lt;String&gt;(); 
      connection = getConnection();
      String queryPattern = "SELECT `Livello_1`, `Livello_2`, `Livello_3`, `Livello_4` FROM Camera WHERE Camera.Nome = '?'";
      PreparedStatement queryStatement = connection.prepareStatement(queryPattern);
      queryStatement.setString(1, roomName);
      ResultSet rs = queryStatement.executeQuery();
      if(rs.next())
      {
          for(int i = 0; i &lt; 3; i++)
          {
              path.add(rs.getString(i));
          }
      }
      return path;
  }
  </code></pre>
  
  <p>I obtain the error message:</p>
  
  <blockquote>
    <p>java.sql.SQLException: Parameter index out of range (1 > number of
    parameters, which is 0).</p>
  </blockquote>
  
  <p>and the error line number points to line</p>
  
  <pre><code>queryStatement.setString(1, roomName);
  </code></pre>