I found a solution with the condition
metaData.getColumnType(columnNumber) == 12
if this condition is met, run the query
SELECT System_Type_Id FROM Sys.Columns WHERE Name = [column name] AND Object_Id = (SELECT Object_Id FROM Sys.Tables WHERE Name = [table name])
for smalldatetime it will return 58
and for datetime it will return 61 .
Ravindra gullapalli 
source share