Oracle 5.0 Reference Manual page 2097

Table of Contents

Advertisement

The conversions that are always guaranteed to work are listed in the following table. The first column
lists one or more MySQL data types, and the second column lists one or more Java types to which the
MySQL types can be converted.
Table 20.24. Connection Properties - Miscellaneous
These MySQL Data Types
CHAR, VARCHAR, BLOB, TEXT, ENUM, and
SET
FLOAT, REAL, DOUBLE PRECISION,
NUMERIC, DECIMAL, TINYINT, SMALLINT,
MEDIUMINT, INTEGER, BIGINT
DATE, TIME, DATETIME, TIMESTAMP
Note
Round-off, overflow or loss of precision may occur if you choose a Java numeric
data type that has less precision or capacity than the MySQL data type you are
converting to/from.
The
ResultSet.getObject()
Java types, following the JDBC specification where appropriate. The value returned by
ResultSetMetaData.GetColumnClassName()
classes see
java.sql.Types
Table 20.25. MySQL Types to Java Types for ResultSet.getObject()
MySQL Type Name
(new in
BIT(1)
MySQL-5.0)
(new in
BIT( > 1)
MySQL-5.0)
TINYINT
BOOL,
BOOLEAN
SMALLINT[(M)]
[UNSIGNED]
MEDIUMINT[(M)]
[UNSIGNED]
INT,INTEGER[(M)]
[UNSIGNED]
BIGINT[(M)]
[UNSIGNED]
FLOAT[(M,D)]
DOUBLE[(M,B)]
DECIMAL[(M[,D])]
Connector/J (JDBC) Reference
method uses the type conversions between MySQL and
Java 2 Platform
Types.
Return value of
GetColumnClassName
BIT
BIT
TINYINT
TINYINT
SMALLINT
[UNSIGNED]
MEDIUMINT
[UNSIGNED]
INTEGER [UNSIGNED]
BIGINT [UNSIGNED]
FLOAT
DOUBLE
DECIMAL
2077
Can always be converted to these Java types
java.lang.String,
java.io.InputStream, java.io.Reader,
java.sql.Blob, java.sql.Clob
java.lang.String, java.lang.Short,
java.lang.Integer,
java.lang.Long, java.lang.Double,
java.math.BigDecimal
java.lang.String, java.sql.Date,
java.sql.Timestamp
is also shown below. For more information on the
Returned as Java Class
java.lang.Boolean
byte[]
java.lang.Boolean
property
tinyInt1isBit
(the default) and the storage size is 1, or
java.lang.Integer
See TINYINT, above as these are aliases for
TINYINT(1), currently.
java.lang.Integer
or not)
java.lang.Integer,
(C/J 3.1 and earlier), or
java.lang.Long
java.lang.Integer
java.lang.Integer, if
java.lang.Long
java.lang.Long, if UNSIGNED
java.math.BigInteger
java.lang.Float
java.lang.Double
java.math.BigDecimal
if the configuration
is set to
true
if not.
(regardless if
UNSIGNED
if
UNSIGNED
for C/J 5.0 and later
UNSIGNED

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents