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
To specifically answer "Get the SQL Type Name from java.sql.Type code", if you are using a version of java that can do reflection, here is a small utility method that pretty much does the same thing:
public Map getAllJdbcTypeNames() {
Map result = new HashMap();
for (Field field : Types.class.getFields()) {
result.put((Integer)field.get(null), field.getName());
}
return result;
}
Add import java.lang.reflect.Field;
to your import declarations. Once you have that in place, simply use it as follows:
...
Map jdbcMappings = getAllJdbcTypeNames();
String typeName = jdbcMappings.get(-5); // now that will return BIGINT
...