title: Java JDBC with mySql - passing id from table
body: <p>Here is the code:</p>
  
  <pre><code>public static Connection getConnection() throws Exception {
  
      String name1 = "Danny";
      String city1 = "Wien";
  
      try {
          String driver = "com.mysql.jdbc.Driver";
          String url = "jdbc:mysql://localhost:3306/supermarket??verifyServerCertificate=false&amp;useSSL=true";
          String username = "myuser";
          String password = "mypass";
          Class.forName(driver);
  
          Connection conn = DriverManager.getConnection(url, username, password);
  
          String sql = "insert into marketinfo "
                  + " (name, country)" + " values (" + name1 + ", " + city1 + ")";
  
          Statement insertie = conn.prepareStatement(sql);
  
          insertie.executeUpdate(sql);
  
      } catch (Exception e) {
          System.out.println(e);
      }
  
      return null;
  }
  </code></pre>
  
  <p>My error is <code>"Unknown column 'Danny' in 'field list'"</code> .</p>
  
  <p>In Sql database my table contains id, name and city. I want to pass the id field because that id is incremented automatically.</p>