title: Choosing between jdbcTemplate.update(String sql,Object[] args,int[] argTypes) and jdbcTemplate.update(String sql,Object[] args)
body: <p>I'm learning the combination of Spring Boot and jdbcTemplate for some basic crud operations, and trying to better understand which update method I should choose.</p>
  
  <p>I understand that the following two class approaches (adapted from <a href="https://kodejava.org/how-do-i-insert-a-new-record-into-a-database-using-jdbctemplate/" rel="nofollow noreferrer">this post</a>) will write the same record to the database.</p>
  
  <p>Example 1:</p>
  
  <pre><code>public class InsertDemo {
  private static final String sql =
          "INSERT INTO records (title, " +
          "    release_date, " +
          "    artist_id, " +
          "    label_id, " +
          "    created) " +
          "VALUES (?, ?, ?, ?, ?)";
  
  private DataSource dataSource;
  
  public InsertDemo(DataSource dataSource) {
      this.dataSource = dataSource;
  }
  
  public void saveRecord(String title, Date releaseDate,
                         Integer artistId, Integer labelId) {
      JdbcTemplate template = new JdbcTemplate(this.dataSource);
  
      Object[] params = new Object[] {
              title, releaseDate, artistId, labelId, new Date()
      };
      int[] types = new int[] {
              Types.VARCHAR,
              Types.DATE,
              Types.INTEGER,
              Types.INTEGER,
              Types.DATE
      };
  
      int row = template.update(sql, params, types);
      System.out.println(row + " row inserted.");
  }
  </code></pre>
  
  <p>Example 2:</p>
  
  <pre><code>public class InsertDemo {
  private static final String sql =
          "INSERT INTO records (title, " +
          "    release_date, " +
          "    artist_id, " +
          "    label_id, " +
          "    created) " +
          "VALUES (?, ?, ?, ?, ?)";
  
  private DataSource dataSource;
  
  public InsertDemo(DataSource dataSource) {
      this.dataSource = dataSource;
  }
  
  public void saveRecord(String title, Date releaseDate,
                         Integer artistId, Integer labelId) {
      JdbcTemplate template = new JdbcTemplate(this.dataSource);
  
      Object[] params = new Object[] {
              title, releaseDate, artistId, labelId, new Date()
      };
  
      int row = template.update(sql, params);
      System.out.println(row + " row inserted.");
  }
  </code></pre>
  
  <p>but I'm unclear on why I would/should use the first one that specifies argument types.  I've read <a href="https://docs.spring.io/spring/docs/4.0.3.RELEASE/javadoc-api/org/springframework/jdbc/core/JdbcTemplate.html#update-java.lang.String-java.lang.Object:A-int:A-" rel="nofollow noreferrer">the javadoc</a> but I'm still not sure why I would need to specify the types.  What am I missing?</p>