Java SQL Type getSQLTypeByName(String type)

Here you can find the source of getSQLTypeByName(String type)

Description

Returns the SQL type by type name.

License

Open Source License

Parameter

Parameter Description
type sql type name

Return

type sql type

Declaration

public static int getSQLTypeByName(String type) 

Method Source Code

//package com.java2s;
/**************************************************************************************
 * Copyright (C) 2008 EsperTech, Inc. All rights reserved.                            *
 * http://esper.codehaus.org                                                          *
 * http://www.espertech.com                                                           *
 * ---------------------------------------------------------------------------------- *
 * The software in this package is published under the terms of the GPL license       *
 * a copy of which has been included with this distribution in the license.txt file.  *
 **************************************************************************************/

import java.util.Map;

public class Main {
    private static Map<String, Integer> sqlTypeMap;

    /**/*from ww  w  .j  a va  2s .  co m*/
     * Returns the SQL type by type name.
     * @param type sql type name
     * @return type sql type
     */
    public static int getSQLTypeByName(String type) {
        Integer val = sqlTypeMap.get(type.toUpperCase());
        if (val != null) {
            return val;
        }
        throw new RuntimeException("Type by name '" + type + "' is not a recognized java.sql.Types type");
    }
}

Related

  1. getSqlType(Object param)
  2. getSqlType(String cubridType)
  3. getSQLType(String text)
  4. getSQLType(String type)
  5. getSqlTypeAsString(int jdbcType)
  6. getSqlTypeByValue(Object value)
  7. getSqlTypeName(int sqlType)
  8. getSQLTypeName(int sqlType)
  9. getSQLTypeName(int sqlType)