Java Reference
In-Depth Information
Table 4-5: Standard Mapping from SQL Types to Java
SQL type
Java Type
Description
of length n, the DBMS invariably assigns n
characters of storage, padding unused space.
VARCHAR
String
Variable-length character string. For a
VARCHAR of length n, the DBMS assigns up
to n charcters of storage, as required.
LONGVARCHAR
String
Variable-length character string. JDBC allows
retrieval of a LONGVARCHAR as a Java input
stream.
NUMERIC
java.math.BigDecimal
Arbitrary-precision signed decimal numbers.
Can be retrieved using either BigDecimal or
String.
DECIMAL
java.math.BigDecimal
Arbitrary-precision signed decimal numbers.
Can be retrieved using either BigDecimal or
String.
BIT
boolean
Yes / No value
TINYINT
byte
8 bit integer values
SMALLINT
short
16 bit integer values
INTEGER
int
32 bit integer values
BIGINT
long
64 bit integer values
REAL
float
Floating point number, mapped to float
FLOAT
double
Floating point number, mapped to double
DOUBLE
double
Floating point number, mapped to double
BINARY
byte[]
Retrieve as byte array.
VARBINARY
byte[]
Retrieve as byte array.
LONGVARBINARY
byte[]
Retrieve as byte array. JDBC allows retrieval of
a LONGVARCHAR as a Java input stream.
DATE
java.sql.Date
Thin wrapper around java.util.Date
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
In addition to the data types supported by the JDBC Core API,
JDBC 2.0 and JDBC 3.0 have introduced support for other data
Cross-Reference
Search WWH ::




Custom Search