title: Insert different datatypes into postgreSQL in a query error
body: <p>I want to insert a record into PostgreSQL database. Most of it's fields are String, but there is also java.sql.date, and BIGINT. How can i do that? My code doesn't seem to work.</p>
  
  <pre><code>    public Record(RecordFields data)
      {
          CreateNewRecord(data);
      }
  
          private void CreateNewRecord(RecordFields recordFields)
          {
              try
              {    
  
                      String addRecord = "INSERT INTO " + GlobalFields.TABLE + " VALUES (? , ? , ? , ? , ? , ? , ? , ? , ?);";
  
                      Connection conn = DataBase.Connect();
  
                      PreparedStatement query = conn.prepareStatement(addRecord);
                      query.setLong(1, recordFieldsID);
                      query.setString(2, recordFields.surname);
                      query.setString(3, recordFields.name);
                      query.setString(4, recordFields.sex);
  
                      DateTime date = recordFields.bornDate.toDateTime();
                      query.setTimestamp(5, new Timestamp(date.getMillis()));
  
                      query.setString(6, recordFields.adress);
                      query.setString(7, recordFields.contact);
                      query.setString(8, recordFields.insurance);
                      query.setString(9, recordFields.commentary);
  
                      query.executeUpdate(addRecord);
          }
          catch(SQLException e)
          {
              e.printStackTrace();
          }
  
  
      }    
  </code></pre>
  
  <p>table generator:</p>
  
  <pre><code>public static void CreateTable()
      {
          try
          {
              Connection conn = DataBase.Connect();
  
              try
              {
                  Statement stat = conn.createStatement();
  
                  String createTable = "CREATE TABLE " + GlobalFields.TABLE 
                      + "(id BIGINT PRIMARY KEY,"
                      + "surname TEXT,"
                      + "name TEXT,"
                      + "sex CHAR(1),"                 
                      + "bornDate DATE,"
                      + "adress TEXT,"
                      + "contact TEXT,"
                      + "insurance TEXT,"
                      + "commentary TEXT);";
  
                  stat.executeUpdate(createTable);
              }
              finally
              {
                  conn.close();
              }
          }
          catch(SQLException e)
          {
              e.printStackTrace();
          } 
      } 
  </code></pre>
  
  <p>public class RecordFields 
  {
      public RecordFields()
      {
      }   </p>
  
  <pre><code>public long id;
  public String surname;
  public String name;
  public String sex;
  public MutableDateTime bornDate;
  public String adress;
  public String contact;
  public String insurance;
  public String commentary;
  </code></pre>
  
  <p>}</p>