Java SQL Type jdbcType2javaType(int jdbcType)

Here you can find the source of jdbcType2javaType(int jdbcType)

Description

jdbc Typejava Type

License

Apache License

Declaration

public static Class<?> jdbcType2javaType(int jdbcType) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.math.BigDecimal;

import java.sql.Time;
import java.sql.Timestamp;
import java.sql.Types;

public class Main {
    public static Class<?> jdbcType2javaType(int jdbcType) {
        switch (jdbcType) {
        case Types.BIT:
        case Types.BOOLEAN:
            // return Boolean.class;
        case Types.TINYINT:
            return Byte.TYPE;
        case Types.SMALLINT:
            return Short.class;
        case Types.INTEGER:
            return Integer.class;
        case Types.BIGINT:
            return Long.class;
        case Types.DECIMAL:
        case Types.NUMERIC:
            return BigDecimal.class;
        case Types.REAL:
            return Float.class;
        case Types.FLOAT:
        case Types.DOUBLE:
            return Double.class;
        case Types.CHAR:
        case Types.VARCHAR:
        case Types.LONGVARCHAR:
            return String.class;
        case Types.BINARY:
        case Types.VARBINARY:
        case Types.LONGVARBINARY:
        case Types.BLOB:
            return byte[].class;
        case Types.DATE:
            return java.sql.Date.class;
        case Types.TIME:
            return Time.class;
        case Types.TIMESTAMP:
            return Timestamp.class;
        default://www .j av a 2 s.co m
            return String.class;
        }
    }
}

Related

  1. isSupportedDataType(int type, String typeName)
  2. isTableMissing(Connection con)
  3. isTextType(int columnType)
  4. isValidReaderOrStream(final Object o)
  5. isXMLType(int type)
  6. jdbcTypeToKylinDataType(int sqlType)
  7. listToJson(List list)
  8. loadAllTypesData(Connection conn)
  9. loadTestDataForEveryType(Connection conn)

  10. HOME | Copyright © www.java2s.com 2016