Mysql语句方式: 1、show table status where name='表名' 2、show columns from 表名 元数据方式: 字段备注: DatabaseMetaData databaseMetaData = conn.getMetaData(); rs = databaseMetaData.getColumns(null, "%", tableName, "%"); while (rs.next()) { String columnName = rs.getString("COLUMN_NAME"); //字段名 String columnComment = rs.getString("REMARKS"); //备注 String sqlType = rs.getString("DATA_TYPE"); //类型 } 表备注: meta = conn.getMetaData(); rs = meta.getTables(null, null, null, new String[] { "TABLE" }); while (rs.next()) { tableInfo.setName(rs.getString("TABLE_NAME")); tableInfo.setComment(rs.getString("REMARKS")); tableInfoList.add(tableInfo); }
查询表与字段备注
最新推荐文章于 2024-02-03 11:16:48 发布