title: How to setFloat a value of a PreparedStatement (jdbc) on NULL
body: <p>I want to insert in my database lots of data with a Java program. I'm trying to manage the fact that the value of the String could be empty, in that way, I want to set the value to null.</p>
  
  <p>This isn't working (<code>pstm.setFloat...</code>) :</p>
  
  <pre><code>PreparedStatement pstm;
  try {
      pstm = connex.prepareStatement("INSERT INTO opfofa._produit_val_nut VALUES (?,?,?,?,?,?,?,?,?,?)");
      pstm.setInt(1,id);
      pstm.setString(2,tabChaine[8]);
      pstm.setFloat(3,tabChaine[9].isEmpty()? null:Float.valueOf(tabChaine[9]));
      ...
      pstm.executeUpdate();
  }catch(PSQLException e) {
      System.out.println("already inserted : "+e);
  }
  </code></pre>
  
  <p>Error : java.lang.NullPointerException and that is normal because we can't set a float to null but in PostgreSQL I can set a Numeric column to null.</p>
  
  <p>How can I do this?</p>