java获得数据库主键信息
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; }
相关推荐
CoderToy 2020-11-16
技术之博大精深 2020-10-16
emmm00 2020-11-17
bianruifeng 2020-11-16
云中舞步 2020-11-12
世樹 2020-11-11
暗夜之城 2020-11-11
张荣珍 2020-11-12
amienshxq 2020-11-14
ASoc 2020-11-14
yungpheng 2020-10-19
loveyouluobin 2020-09-29
尘封飞扬 2020-09-29
Coder技术文摘 2020-09-29
lbyd0 2020-11-17
BigYellow 2020-11-16
sushuanglei 2020-11-12
我心似明月 2020-11-09