Java SQL Type getTypeName(int typeNumber)

Here you can find the source of getTypeName(int typeNumber)

Description

returns the type names based on the type from java.sql.Types

License

Open Source License

Declaration


public static String getTypeName(int typeNumber) 

Method Source Code

//package com.java2s;
// The source code contained herein is licensed under the IBM Public License

import java.sql.*; // @J1c

public class Main {
    /**//from w  w w  .j a  va  2  s .  c  om
     * returns the type names based on the type from java.sql.Types
     */

    public static String getTypeName(int typeNumber) {
        switch (typeNumber) {
        case Types.SMALLINT:
            return "SMALLINT";
        case Types.INTEGER:
            return "INTEGER";
        case Types.BIGINT:
            return "BIGINT";
        case Types.FLOAT:
            return "FLOAT";
        case Types.REAL:
            return "REAL";
        case Types.DOUBLE:
            return "DOUBLE";
        case Types.NUMERIC:
            return "NUMERIC";
        case Types.DECIMAL:
            return "DECIMAL";
        case -360:
            return "DECFLOAT";
        case Types.CHAR:
            return "CHAR";
        case Types.VARCHAR:
            return "VARCHAR";
        case Types.DATALINK:
            return "DATALINK";
        case Types.BINARY:
            return "BINARY";
        case Types.VARBINARY:
            return "VARBINARY";
        case Types.TIME:
            return "TIME";
        case Types.DATE:
            return "DATE";
        case Types.TIMESTAMP:
            return "TIMESTAMP";
        case Types.BLOB:
            return "BLOB";
        case Types.CLOB:
            return "CLOB";

            //
            // New for JDK 1.6
            //

        case -8: /* Types.ROWID */
            return "ROWID";
        case -15: /* Types.NCHAR */
            return "NCHAR";
        case -9: /* Types.NVARCHAR */
            return "NVARCHAR";
        case 2011: /* Types.NCLOB */
            return "NCLOB";
        case -16: /*  Types.LONGNVARCHAR */
            return "NVARCHAR";
        case 2009: /* Types.SQLXML */
            return "SQLXML";

        default:
            return "UNKNOWN";

        }
    }
}

Related

  1. getTableTypes(DatabaseMetaData dbmd)
  2. getTinyIntTypeString(Connection conn)
  3. getType(int csqltype)
  4. getTypeforValue(int type)
  5. getTypeName(int dataType)
  6. getTypeNameForJDBCType(int jdbcType)
  7. getTypeStringForObject(Object o)
  8. getUDTOwner(String typeName, String dbName, Connection conn)
  9. getValueType(String inputValue)