Java SQL Type getJDBCTypes()

Here you can find the source of getJDBCTypes()

Description

get JDBC Types

License

Open Source License

Declaration

public static String[] getJDBCTypes() 

Method Source Code


//package com.java2s;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;

import java.sql.Types;
import java.util.HashMap;
import java.util.Map;

public class Main {
    static Map<String, Object> jdbcTypes;

    public static String[] getJDBCTypes() {
        checkTypes();/*  w w  w .  jav a2  s .  com*/

        return (String[]) jdbcTypes.keySet().toArray(new String[jdbcTypes.size()]);
    }

    private static void checkTypes() {
        if (jdbcTypes == null) {
            jdbcTypes = new HashMap<String, Object>();
            Field[] fields = Types.class.getFields();
            for (int i = 0; i < fields.length; i++) {
                Field field = fields[i];
                if (Modifier.isStatic(field.getModifiers())) {
                    try {
                        jdbcTypes.put(field.getName(), field.get(Types.class));
                    } catch (IllegalArgumentException e) {
                        // ignore                  
                    } catch (IllegalAccessException e) {
                        // ignore               
                    }
                }
            }
        }
    }
}

Related

  1. getJdbcTypeClass(int type)
  2. getJDBCTypeForNamedType(String aTypeName)
  3. getJdbcTypeName(int jdbcType)
  4. getJDBCTypeName(int value)
  5. getJdbcTypeNames()
  6. getLength(String format, String columnTypeName)
  7. getLong(Object object)
  8. getMBTileData(int column, int row, int zoomLevel, String jdbcConnectionString)
  9. getMBTileData(int column, int row, int zoomLevel, String jdbcConnectionString)