Database data type mappings in Java

This article will show you the relationship between database data type (ex PostgreSQL) and java data types

Table of Contents

Example

Data type on the serverJava data typeData types prescribed by java.sql.Types
characterStringjava.sql.Types.CHAR
national characterStringjava.sql.Types.NCHAR
character varyingStringjava.sql.Types.VARCHAR
national character varyingStringjava.sql.Types.NVARCHAR
textStringjava.sql.Types.VARCHAR
byteabyte[]java.sql.Types.BINARY
smallintshortjava.sql.Types.SMALLINT
integerintjava.sql.Types.INTEGER
bigintlongjava.sql.Types.BIGINT
smallserialshortjava.sql.Types.SMALLINT
serialintjava.sql.Types.INTEGER
bigseriallongjava.sql.Types.BIGINT
realfloatjava.sql.Types.REAL
double precisiondoublejava.sql.Types.DOUBLE
numericjava.math.BigDecimaljava.sql.Types.NUMERIC
decimaljava.math.BigDecimaljava.sql.Types.DECIMAL
moneyStringjava.sql.Types.OTHER
datejava.sql.Datejava.sql.Types.DATE
time with time zonejava.sql.Timejava.sql.Types.TIME
time without time zonejava.sql.Timejava.sql.Types.TIME
timestamp without time zonejava.sql.Timestampjava.sql.Types.TIMESTAMP
timestamp with time zonejava.sql.Timestampjava.sql.Types.TIMESTAMP
intervalorg.postgresql.util.PGIntervaljava.sql.Types.OTHER
booleanbooleanjava.sql.Types.BIT
bitbooleanjava.sql.Types.BIT
bit varyingorg.postgresql.util.Pgobjectjava.sql.Types.OTHER
oidlongjava.sql.Types.BIGINT
xmljava.sql.SQLXMLjava.sql.Types.SQLXML
arrayjava.sql.Arrayjava.sql.Types.ARRAY
uuidjava.util.UUIDjava.sql.Types.OTHER
pointorg.postgresql.geometric.Pgpointjava.sql.Types.OTHER
boxorg.postgresql.geometric.Pgboxjava.sql.Types.OTHER
lsegorg.postgresql.geometric.Pglsegjava.sql.Types.OTHER
pathorg.postgresql.geometric.Pgpathjava.sql.Types.OTHER
polygonorg.postgresql.geometric.PGpolygonjava.sql.Types.OTHER
circleorg.postgresql.geometric.PGcirclejava.sql.Types.OTHER
jsonorg.postgresql.util.PGobjectjava.sql.Types.OTHER
Network address type (inet,cidr,macaddr)org.postgresql.util.PGobjectjava.sql.Types.OTHER
Types related to text searches (svector, tsquery)org.postgresql.util.PGobjectjava.sql.Types.OTHER
Enumerated typeorg.postgresql.util.PGobjectjava.sql.Types.OTHER
Composite typeorg.postgresql.util.PGobjectjava.sql.Types.OTHER
Range typeorg.postgresql.util.PGobjectjava.sql.Types.OTHER

Reference

Leave a Comment

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.

Scroll to Top