PostgreSQL
 sql >> Database >  >> RDS >> PostgreSQL

In che modo i tipi di data vengono gestiti dal driver JDBC?

Una mappatura dei tipi JSR 310 ai tipi SQL è fornita nella documentazione Tabella 5.1 .

Ispezione del driver JDBC di PostgreSQL PgPreparedStatement.setObject() possiamo vedere che ogni tipo Java viene utilizzato per impostare un timestamp, ad esempio:

case Types.TIMESTAMP_WITH_TIMEZONE:
  if (in instanceof java.time.OffsetDateTime) {
    setTimestamp(parameterIndex, (java.time.OffsetDateTime) in);

Internamente si chiama TimestampUtils.toString() che sta convertendo una data e ora in una stringa.