public String getPrimaryName(Connection conn) throws Exception{
DatabaseMetaData md = conn.getMetaData();
ResultSet rs = md.getPrimaryKeys(null, null, "gsm_alert_check");
while(rs.next()){
System.out.println(rs.getString("TABLE_CAT"));
System.out.println(rs.getString("TABLE_SCHEM"));
System.out.println(rs.getString("TABLE_NAME"));
System.out.println(rs.getString("COLUMN_NAME"));
System.out.println(rs.getString("KEY_SEQ"));
System.out.println(rs.getString("PK_NAME"));
}
rs.close();
return null;
}
java获得数据库主键信息
最新推荐文章于 2023-08-14 22:23:09 发布