Map<Integer, String> types = new HashMap<Integer, String>();
for (Field field : java.sql.Types.class.getFields()) {
types.put((Integer)field.get(null), field.getName());
}
JDBCTypeMapping jdbcTypeMapping = new JDBCTypeMapping();
DatabaseMetaData metadata = Connections.getConnection().getMetaData();
ResultSet rs = metadata.getColumns(null, null, "type_tests", null);
try {
while (rs.next()) {
System.out.println(rs.getString("COLUMN_NAME"));
System.out.println(types.get(rs.getInt("DATA_TYPE")));
System.out.println(rs.getInt("COLUMN_SIZE"));
System.out.println(rs.getInt("DECIMAL_DIGITS"));
System.out.println(jdbcTypeMapping.get(
rs.getInt("DATA_TYPE"),
rs.getInt("COLUMN_SIZE"),
rs.getInt("DECIMAL_DIGITS")));
System.out.println();
}