HPlogo HP Driver for JDBC User's Manual: HP 3000 MPE/iX Computer Systems > Chapter 5 ALLBASE/SQL Specifics

ALLBASE/SQL to JDBC Data Type Conversions

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

Table 5-2 “Data Type Conversions” shows the supported data type conversions between ALLBASE/SQL and JDBC. For conversions from JDBC to Java, please refer to a JDBC book or the Java JDBC documentation. Those conversions are generic to all JDBC Drivers.

A description of each ALLBASE/SQL and JDBC data type can be found in Appendix A “Data Types”

Suggested conversions are denoted by a capital letter "X" in the conversion grid. Conversions which are supported, but which may result in a loss of precision, overflow, or rounding, are denoted by a lowercase letter "x" in the conversion grid.

Table 5-2 Data Type Conversions

JDBC DATA TYPES (vertical)

TINYINTSMALLINT

INTEGER

BIGINTREALFLOATDOUBLEDECIMALNUMERICBITCHARVARCHARLONGVARCHARBINARYVARBINARYLONGVARBINARYDATETIMETIMESTAMP

ALLBASE/SQL DATA TYPES (horizontal)

SMALLINT (16-bits)

x

X

XXXX

X

XXxXXXxxx

  

INTEGER (32-bits)

xxXXxxx

X

X

x

XXX

x

xx

REAL

xxxxXXX

X

XXXXXx

x

x

FLOAT(1...24)

xxxxxx

X

XXXXXX

x

x

x

FLOAT(25...53)

x

x

x

x

x

x

X

X

X

X

x

x

x

x

x

x

DOUBLE PRECISION

xxx

x

x

x

X

X

X

x

X

X

X

x

xx

DECIMAL

xxxxxxxXXxXXXxxx 

NUMERIC

xxxxxxxXXxXXXxxx 

CHAR

xxxxxxxxxxXXXxxx 

VARCHAR

xxxxxxxxxxXXXxxx 

DATE

XXXxxxX

x

TIME

XXX

x

xx

Xx

DATETIME

XXXxxxxxX

INTERVAL

XXX

x

xx

 

The conversion of any ALLBASE/SQL data type to the java.sql.Types.BIT data type is such that only the value of zero, in either numeric or character format, will be converted to the java.sql.Types.BIT value of 0. All other values will be converted to the java.sql.Types.BIT value of 1. Thus only the integer value 0, the floating-point value 0.0, the decimal value 0 (not 0.0), and the character string "0" will be converted to a bit value of 0. Everything else is converted to a bit value of 1.

The conversion of an ALLBASE/SQL data type to a JDBC data type that has a smaller degree of precision (such as conversion from ALLBASE/SQL INTEGER to java.sql.Types.SMALLINT) will follow the Java VM rules of casting one data type to another. This may result in different values on different Java platforms. There is also no warning generated when this occurs. It is up to the application developer to choose the appropriate JDBC data type.

The conversion of an ALLBASE/SQL character data type to a JDBC numeric data type uses the Java numeric conversion routines and any necessary numeric casting. Thus this could result in a java.lang.NumberFormatException being shown when the conversion is performed. Again, the application developer should take the necessary precautions.

Feedback to webmaster