General Reference



Chapter 3   Java and SQL Object Conversions

This chapter provides reference tables for Java and SQL object type mappings.

    For more information about Java and SQL object conversions, see the API help page for AgConvert.

Converting SQL types to Java types   Top of page

SQL type

Java type

Notes

CHAR

String

Fixed length string of characters

VARCHAR

String

Variable length string of characters

LONGVARCHAR

String
java.io.InputStream

Any length (multi-megabyte) strings

NUMERIC

java.math.BigDecimal

Absolute precision decimal values

DECIMAL

java.math.BigDecimal

Absolute precision decimal value

BIT

Boolean

Single bit/binary value (on or off)

TINYINT

Byte

8-bit integer

SMALLINT

Short

16-bit integer

INTEGER

Integer

Signed 32-bit integer

BIGINT

Long

Signed 64-bit integer

REAL

Float

Floating-point value

FLOAT

Float

Floating-point value

DOUBLE

Double

Large floating-point value

BINARY

byte[]

Array of binary values

VARBINARY

byte[]

Variable length array of binary values

LONGVARBINARY

byte[]

Any length (multi-megabyte) array of binary values

DATE

java.sql.Date

Date value

TIME

java.sql.Time

Time value

TIMESTAMP

java.sql.Timestamp

Time value with additional nanosecond field

Converting Java object types to SQL types   Top of page

Java type

SQL type

String

VARCHAR
LONGVARCHAR

java.math.BigDecimal

NUMERIC

Boolean

BIT

Integer

INTEGER

Long

BIGINT

Float

FLOAT

Double

DOUBLE

Byte[ ]

VARBINARY
LONGVARBINARY

Byte

TINYINT

Short

SMALLINT

java.sql.Date

DATE

java.sql.Time

TIME

java.sql.Timestamp

TIMESTAMP






Copyright © 2000, SilverStream Software, Inc. All rights reserved.