I have an array with Field Names and jdbc Type codes. (Those int codes that you can find in
http://download.oracle.com/javase/1.4.2/docs/api/constant-values.html#java.s
Spring has a handy helper Enum called JdbcTypesEnum, but it is indeed quite strange, that this is not part of JDBC proper. However, instead of using
rs = connection.getMetaData().getColumns();
...
int dataType = rs.getInt("DATA_TYPE");
I would use
String typeName = rs.getString("TYPE_NAME");
when retrieving the column type. For example when inspecting a H2 database table with a special VARCHAR_IGNORECASE or UUID
type:
dataType vs. typeName
UUID: -2=BINARY vs. "UUID"
VARCHAR_IGNORECASE: 12=VARCHAR vs. "VARCHAR_IGNORECASE"
But note, that you cannot cover the type range of the string for all databases, in this case the int would be somewhat more handy (but it is after all not a closed Enum type).