title: Exception java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0)
body: <p>I'm getting this error:</p>
  <pre><code>Exception java.sql.SQLException: Parameter index out of range (1 &gt; number of parameters, which is 0).
  java.sql.SQLException: Parameter index out of range (1 &gt; number of parameters, which is 0).
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
   at com.mysql.jdbc.PreparedStatement.checkBounds(PreparedStatement.java:3288)
   at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:3272)
   at com.mysql.jdbc.PreparedStatement.setString(PreparedStatement.java:4108)
   at com.inmobia.RSSToNews.Consumer.print(Consumer.java:92)
   at com.inmobia.RSSToNews.Consumer.main(Consumer.java:122)
  </code></pre>
  <p>When I'm trying to execute this class:</p>
  <pre><code>package com.in.RSSToNews;
  import java.net.URL;
  import java.util.ArrayList;
  import java.util.Date;
  import java.util.Iterator;
  import java.util.List;
  import java.net.URLConnection;
  import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.PreparedStatement;
  import java.sql.ResultSet;
  import java.sql.Statement;
  import java.text.ParseException;
  import java.text.SimpleDateFormat;
  
  import com.sun.syndication.feed.synd.SyndEntry;
  import com.sun.syndication.feed.synd.SyndFeed;
  import com.sun.syndication.io.SyndFeedInput;
  import com.sun.syndication.io.XmlReader;
  
  /**
   * Consumer class from RSS/Atom feed type.
   *
   * @author  Rbn
   */
  
  public class Consumer {
  
  
  
  
  
  SyndFeed    feed;
  
  /**
   * Class constructor
   *
   * @param url: url path to consume
   */
  public Consumer(String url) {
      super();
      try {
          URL feedUrl = new URL(url);
  
          SyndFeedInput input = new SyndFeedInput();
          feed = input.build(new XmlReader(feedUrl));
  
      } catch (Exception ex) {
          ex.printStackTrace();
          System.out.println(&quot;ERROR: &quot;+ex.getMessage());
      }
  }
  
  /**
   * print method
   * Scroll down the list of entries and displays the feed title, author and description
   */
  void print () {
  
      //feeds list
      List&lt;SyndEntry&gt; entradas = new ArrayList&lt;SyndEntry&gt;();
      entradas = feed.getEntries();
      try
      {
      
          
          //list iterator
      Iterator&lt;SyndEntry&gt; it = entradas.iterator();
      Class.forName(&quot;org.gjt.mm.mysql.Driver&quot;);
      Connection conexion = DriverManager.getConnection(&quot;jdbc:mysql://localhost/newsamerica&quot;, &quot;root&quot;, &quot;123&quot;);
      
          if (!conexion.isClosed())
          {
                      while (it.hasNext()) 
                          {
                              SyndEntry entrada = it.next();
                              String title=(entrada.getTitle() );
                              String link=(entrada.getLink());
                              String author=(entrada.getAuthor());
                              String description=(&quot;&quot;+entrada.getDescription() );
                              Date date=(entrada.getPublishedDate());
                              String date2= date.toString();
                              
                              String content=(&quot;&quot;+entrada.getContents());
                                        
                              //description=description.replaceAll(&quot;SyndContentImpl.value=&quot;, &quot;&quot;);
                              //System.out.println(text2);
                              //System.out.println(&quot;Autor.......: &quot; + entrada.getAuthor() );
                              // System.out.println(&quot;Noticia.......: &quot; + entrada.getContents());
                              // Statement st = conexion.createStatement();
                              PreparedStatement pstmt = conexion.prepareStatement(&quot;INSERT INTO general_news(title,link,author,description,date,content) VALUES ('?','?','?','?','?','?')&quot;);
                              pstmt.setString(1,title);
                              pstmt.setString(2,link);
                              pstmt.setString(3,author);
                              pstmt.setString(4,description);
                              pstmt.setString(5,date2);
                              pstmt.setString(6,content);
                              ResultSet rs = pstmt.executeQuery();
                              rs.next();
                          }
      
      
     
          }
          
      
          conexion.close();
  }
  
      catch (Exception e)
      {
         // Error en algun momento.
         System.out.println(&quot;Excepcion &quot;+e);
         e.printStackTrace();
      }
  }
  
  
  public static void main(String[] args) {
     
      Consumer feed = new Consumer (args[0]);
      feed.print();
  }
  }
  </code></pre>