Java Utililty Methods SQL Type

List of utility methods to do SQL Type

Description

The list of methods to do SQL Type are organized into topic(s).

Method

StringgetDoubleTypeString(Connection conn)
get Double Type String
if (isSQLServer(conn))
    return "FLOAT"; 
return "DOUBLE PRECISION";
String[]getExpressionChoices(int type)
get Expression Choices
String[] choices = new String[] { "none", "sum", "average", "min", "max", "item-count", "group-count" }; 
if (type == Types.VARCHAR) {
    choices = new String[] { "none", "item-count", "group-count" }; 
} else if (type == Types.DATE || type == Types.TIME || type == Types.TIMESTAMP) {
    choices = new String[] { "none", "item-count", "group-count" }; 
return choices;
StringgetFormatTypeAsString(int fieldType)
Get the String representing the format-type associated with the value in fieldType.
switch (fieldType) {
case Types.DATE:
    return "date"; 
case Types.NUMERIC:
    return "number"; 
case Types.VARCHAR:
    return null;
default:
...
StringgetInsertarEmpresa()
get Insertar Empresa
return "INSERT INTO tblempresa( id_empresa, nombre, logo, estado) values (?,?,?,?)";
StringgetIntTypeString(Connection conn)
get Int Type String
return "INT";
IntegergetIntValue(String typeName)
Returns an int value for the specified type name from Types or any other class containing SQL type constants, for example oracle.jdbc.OracleTypes .
Integer ret = (Integer) encoder.get(typeName);
if (ret == null) {
    ret = extractConstant(typeName);
    encoder.put(typeName, ret);
return ret;
StringgetJavaType(int dataType, int columnSize, int decimalDegit)
get Java Type
String fieldType = String.class.getName();
switch (dataType) {
case Types.ARRAY:
    break;
case Types.BIGINT:
    fieldType = "long";
    break;
case Types.BINARY:
...
StringgetJavaType(int jdbcType)
get Java Type
switch (jdbcType) {
case Types.BIT:
    return Boolean.class.getName();
case Types.TINYINT:
    return Byte.class.getName();
case Types.SMALLINT:
    return Short.class.getName();
case Types.CHAR:
...
ClassgetJavaType(int sqlType)
get Java Type
switch (sqlType) {
case Types.CHAR:
case Types.VARCHAR:
case Types.LONGVARCHAR:
case Types.CLOB:
    return String.class;
case Types.BINARY:
case Types.VARBINARY:
...
IntegergetJavaType(String rdbType)
rdb type to java
Integer javaType = mapTypes.get(rdbType);
if (javaType == null) {
    return java.sql.Types.VARCHAR;
return javaType;