Java SQL Type sqlTypeFromString(String sqlType)

Here you can find the source of sqlTypeFromString(String sqlType)

Description

sql Type From String

License

LGPL

Declaration

public static int sqlTypeFromString(String sqlType) 

Method Source Code


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

import java.sql.Types;

public class Main {
    public static int sqlTypeFromString(String sqlType) {
        sqlType = sqlType.toUpperCase();

        switch (sqlType) {
        case "ARRAY":
            return (Types.ARRAY);
        case "BIGINT":
            return (Types.BIGINT);
        case "BINARY":
            return (Types.BINARY);
        case "BIT":
            return (Types.BIT);
        case "BLOB":
            return (Types.BLOB);
        case "BOOLEAN":
            return (Types.BOOLEAN);
        case "CHAR":
            return (Types.CHAR);
        case "CLOB":
            return (Types.CLOB);
        case "DECIMAL":
            return (Types.DECIMAL);
        case "DOUBLE":
            return (Types.DOUBLE);
        case "FLOAT":
            return (Types.FLOAT);
        case "LONGVARCHAR":
            return (Types.LONGVARCHAR);
        case "NUMERIC":
            return (Types.NUMERIC);
        case "SMALLINT":
            return (Types.SMALLINT);
        case "TINYINT":
            return (Types.TINYINT);
        case "INTEGER":
            return (Types.INTEGER);
        case "VARCHAR":
            return (Types.VARCHAR);
        case "SQLXML":
            return Types.SQLXML;
        case "TIMESTAMP":
            return Types.TIMESTAMP;
        default:/*from  w w  w . java2s  .  c  om*/
            return (Types.VARCHAR); //default
        }
    }
}

Related

  1. resolveEscapes(String escaped, boolean noBackslashEscapes)
  2. setFieldValue(Object oBean, String sFieldName, Object oValue)
  3. setProperty(Object object, String name, String value)
  4. sqlType2Name(int sqlType)
  5. sqlType4Object(Object obj)
  6. sqlTypeIsNumeric(int sqlType)
  7. sqlTypeName(final int value)
  8. sqlTypeString(int sqlType)
  9. sqlTypeToClass(int sqlType, String className)