title: MySQL connection in Java problem
body: <p>I try to get some data form database. The connection method works for sure, but I have a problem getting any data form DB:</p>
  
  <pre><code>    SQLConnect s = new SQLConnect();
      Connection c = s.getConnection();
  
      Statement st = c.createStatement();
  
      ResultSet rs = st.executeQuery("select * from produkty");
      System.out.println(rs.getString(2));
  </code></pre>
  
  <p>The problem is with the last line (when I comment it, no error appears).
  Error message:</p>
  
  <pre><code>Connected to database
  Exception in thread "main" java.sql.SQLException: Before start of result set
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)
      at com.mysql.jdbc.ResultSetImpl.checkRowPos(ResultSetImpl.java:841)
      at com.mysql.jdbc.ResultSetImpl.getStringInternal(ResultSetImpl.java:5656)
      at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5576)
      at antmedic.Main.main(Main.java:85)
  Java Result: 1
  BUILD SUCCESSFUL (total time: 1 second)
  </code></pre>
  
  <p>Thanks for any help</p>