title: How to insert a value form java to database mysql...?
body: <p>I have searched to insert a value from application java into a mysql table.
  Following there's my code. The result of it is a long row of error, but the first row is: <code>java.sql.SQLException:</code> Before start of result set</p>
  
  <pre><code>        Connection con = null; //oggetto di connessione
  
          try {
  
              Class.forName("com.mysql.jdbc.Driver"); //connessione 
              con = DriverManager.getConnection("jdbc:mysql://localhost/autonoleggio", "root", "");//connessione vera e propria
                                  //quarto va cambiato col nome del database creato         
  
              Statement st = con.createStatement();
              ResultSet rs = st.executeQuery("SELECT * FROM dati"); // persone -&gt;tabella presente nel database 
  
              if(targa.getText().equals(rs.getString("Targa")))       
              {
                  Statement insideStatement = con.createStatement(); 
                  ResultSet insideResultsSet = insideStatement.executeQuery(
                          "INSERT INTO dati (Cliente) VALUES ('"+inserisci.getText()+"');"
                      );
                  /*String query;
                  query="INSERT INTO dati (Cliente) VALUES ('"+inserisci.getText()+"');";                 
                  PreparedStatement statement = con.prepareStatement(query);    
                  statement.executeUpdate();
                  statement.close();  */
              }
  
  
  
          } catch (Exception e) {
              e.printStackTrace();
          } finally {
              if(con != null) {
                  con.close();
              }
          }
  </code></pre>