Java SQL Type getJavaType(String rdbType)

Here you can find the source of getJavaType(String rdbType)

Description

rdb type to java

License

Open Source License

Parameter

Parameter Description
rdbType a parameter

Declaration

public static Integer getJavaType(String rdbType) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2013 hangum./*from w  w  w  . j av a 2  s.  c o m*/
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser Public License v2.1
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * 
 * Contributors:
 *     hangum - initial API and implementation
 ******************************************************************************/

import java.util.HashMap;
import java.util.Map;

public class Main {
    private static Map<String, Integer> mapTypes = new HashMap<String, Integer>();

    /**
     * rdb type to java
     * 
     * @param rdbType
     * @return
     */
    public static Integer getJavaType(String rdbType) {
        Integer javaType = mapTypes.get(rdbType);
        if (javaType == null) {
            //         logger.info("SQL type to Java type not found is" + rdbType);
            return java.sql.Types.VARCHAR;
        }

        return javaType;
    }
}

Related

  1. getIntTypeString(Connection conn)
  2. getIntValue(String typeName)
  3. getJavaType(int dataType, int columnSize, int decimalDegit)
  4. getJavaType(int jdbcType)
  5. getJavaType(int sqlType)
  6. getJavaTypeFromSqlType(int sqlType)
  7. getJavaTypeNameByJdbcType(int jdbcType)
  8. getJdbcType(int firebirdType)
  9. getJdbcType(String datatype)