| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
When you are receiving data from a ResultSet:
| MySQL type | Java type |
|---|---|
| date | LocalDate |
| datetime | LocalDateTime |
| new_date | LocalDate |
| timestamp | LocalDateTime |
| tinyint | Byte |
| smallint | Short |
| year | Short |
| float | Float |
| double | Double |
| int24 | Int |
| mediumint | Int |
| bigint | Long |
| numeric | BigDecimal |
| new_decimal | BigDecimal |
| decimal | BigDecimal |
| string | String |
| var_string | String |
| varchar | String |
| time | java.util.Duration |
| text | String |
| JSON | String |
| enum | String |
| blob | ByteArray |
Now when you're setting parameters for a prepared statement:
| Java type | MySQL type |
|---|---|
| Byte | tinyint |
| Short | smallint |
| Int | mediumint |
| Float | float |
| Double | double |
| BigDecimal | decimal |
| LocalDate | date |
| DateTime | timestamp |
| java.util.Duration | time |
| java.sql.Date | date |
| java.util.Date | timestamp |
| java.sql.Timestamp | timestamp |
| java.sql.Time | time |
| String | string |
| ByteArray | blob |
| java.nio.ByteBuffer | blob |
| io.netty.buffer.ByteBuf | blob |
The maximum size of a blob is 2^24-9 bytes (almost 16 MiB).
You don't have to match exact values when sending parameters for your prepared statements, MySQL is usually smart enough to understand that if you have sent an Int to smallint column it has to truncate the 4 bytes into 2.
null values are supported, In prepared statement pass null.
| Back | FazBrowse Home | New Git URL |