If you are doing it in Java, there is a class ResultSetMetaData.
You can use ResultSetMetaData.getColumnClassName() to get the fully qualified name of the class.
For example, if the datatype in database is VARCHAR, the value returned is java.lang.String.
Also try using ResultSetMetaData.getColumnLabel() - see whether its applicable in your case.
Java Documentation for ResultSetMetaData