title: Exception in MySQL
body: <p>I have written a code in Java which has to populate a dot file. I am getting the error and I cant figure out why. All of the paths have been set.</p>
  
  <pre><code>Class.forName("com.mysql.jdbc.Driver");                     
  Connection connects = DriverManager.getConnection("jdbc:mysql://localhost:3306/userlogin", "root","12345");
  Statement stm = connects.createStatement();
  ResultSet rs=stm.executeQuery("SELECT * FROM authors_4 WHERE self_authors='"+getTxt+"'");
  
                           int l=0;
                           /*if(rsx.next())
                           {
                               div = Double.parseDouble(rsx.getString("divs"));
  
  
                           }*/
  
  
                         do
                           {
                               if(l==0)
                               {
  
                                   diva = Integer.parseInt(rs.getString("tot_pub"));
  
                                   //fout.write("a [label=" + "\"" + rsx.getString(2) + "\\n" + rsx.getString(4) + "\"" + "color=blue,fontsize=24,fontcolor=red,style=filled];\r\n");
                                   fout.write("\"" + rs.getString("self_authors") + "\"" + "[fixedsize=true, width="+diva+",height="+diva+", label=" + "\"" + rs.getString("self_authors") + "\\n" + rs.getString("tot_pub") + "\"" + "color=blue,fontsize=24,fontcolor=red,style=filled];\r\n");
                                 l++;
                               }
  
  
                               divb = Integer.parseInt(rs.getString("tot_pub")) ;
  
                               fout.write("\"" + rs.getString("co_auths") + "\"" + "[fixedsize=true, width="+divb+",height="+divb+",label=" + "\"" + rs.getString("co_auths") + "\\n" + rs.getString("tot_pub") + "\"];" +"\r\n");    
  
  
                               //fout.write("a -&gt;" + "\"" + rsx.getString(6) + "\"" + "[penwidth=" +  rsx.getString(8)  +", label =" + rsx.getString(8) +" ];" + "\r\n");
                                 fout.write("\"" + rs.getString("self_authors") + "\" -&gt;" + "\"" + rs.getString("co_auths") + "\"" + "[penwidth=" +  rs.getString("1")  +", label =" + 1 +" ];" + "\r\n");
  
                               //System.out.println(rsx.getString(1));
  
                           }while(rs.next());
  
                           fout.write("}");
                           fout.close();
                       }
  </code></pre>
  
  <p>The code that I have written is very long and cant be explained so I'm only posting the portion where I am getting exceptions.</p>
  
  <p>The exceptions are:</p>
  
  <pre><code>java.sql.SQLException: Before start of result set
  at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)
  at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
  at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975)
  at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920)
  at com.mysql.jdbc.ResultSetImpl.checkRowPos(ResultSetImpl.java:855)
  at com.mysql.jdbc.ResultSetImpl.getStringInternal(ResultSetImpl.java:5773)
  at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5693)
  at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5733) 
  </code></pre>