Standard SQL Data Types with Their Java Equivalents : Database Type vs Java Type « Database SQL JDBC « Java






Standard SQL Data Types with Their Java Equivalents

 

SQL type            Java Type                 Description

BINARY              byte[]                    Byte array. Used for binary large objects.

BIT                 boolean                   Boolean 0 / 1 value

CHAR                String                    Fixed-length character string. 

DATETIME            java.sql.Date             Date and Time as: yyyy-mm-dd hh:mm:ss

DECIMAL             java.math.BigDecimal      Arbitrary-precision signed decimal numbers. 

FLOAT               double                    Floating-point number, mapped to double

INTEGER             int                       32-bit integer values

LONGVARBINARY       byte[]                    Variable-length character string. 

LONGVARCHAR         String                    Variable-length character string. 

NCHAR               String                    National Character Unicode fixed-length character string

NUMERIC             java.math.BigDecimal      Arbitrary-precision signed decimal numbers. 

NTEXT               String                    Large string variables. 

NVARCHAR            String                    National Character Unicode variable-length character string

REAL                float                     Floating-point number, mapped to float

SMALLINT            short                     16-bit integer values

TIME                java.sql.Time             Thin wrapper around java.util.Date

TIMESTAMP           java.sql.Timestamp        Composite of a java.util.Date and a separate nanosecond value

VARBINARY           byte[]                    Byte array

VARCHAR             String                    Variable-length character string. 

 








Related examples in the same category

1.Get Available Table Types
2.All data types for Oracle
3.Create Table With All Data Types In MySQL
4.Get Available Sql Types In A Database
5.Sql DateTime