title: Pushing jsoup elements into a database
body: <p>I'm using the Jsoup HTML parser to get information from a particular website, in my case the name of a product and the price of the product.</p>
  <p>After fetching the above mentioned I have two different array lists of product names and their equivalent prices.</p>
  <p>Now, I have to put them both in a database table as a pair of course, but this is where I'm getting stuck. Is there a way to solve this?</p>
  <p>Here's the snippet below...</p>
  <pre><code>Document document = Jsoup.connect(&quot;http://www.winwin.rs/&quot;).timeout(6000).get();
  
  Elements names = document.getElementsByClass(&quot;product-name&quot;);
  Elements prices = document.getElementsByClass(&quot;price&quot;);
  
  String query = &quot;insert into product (name, price) values (?, ?)&quot;;
  Connection conn = mysqlconnect.ConnectDb();
  PreparedStatement preparedStmt = conn.prepareStatement(query);
  
  for (Element element : names) {
      preparedStmt.setString(1, element.text()); 
  }
  
  for (Element element : prices) {
      preparedStmt.setString(2, element.text()); 
  }
  
  preparedStmt.execute();
  conn.close();
  </code></pre>