示例代码片段:
ResultSet resultSet = statement.executeQuery(sql);
ResultSetMetaData metaData = resultSet.getMetaData();
System.out.println(metaData.getColumnCount());
for (int i = 1 ; i <= metaData.getColumnCount(); i ++) {
System.out.println(metaData.getColumnType(i));
System.out.println(metaData.getColumnTypeName(i));
}
类型清单如下:
参考链接:https://alvinalexander.com/java/edu/pj/jdbc/recipes/ResultSet-ColumnType.shtml
原文:https://www.cnblogs.com/zifeiy/p/9617170.html