public static Map getmap(String synonymsName(表名)) {
Map map = new HashMap(); Connection ct = null; Statement sm = null; ResultSet rs = null; try {
// 加载驱动
Class.forName(\);
// 得到连接
ct = DriverManager.getConnection(
\, \,
\);
sm = ct.createStatement();
String sql = \ + synonymsName + \;
rs = sm.executeQuery(sql);
ResultSetMetaData md = rs.getMetaData(); for (int i = 1; i <= md.getColumnCount(); i++) {
map.put(md.getColumnName(i), md.getColumnTypeName(i)); }
} catch (Exception e) { e.printStackTrace(); } finally { try {
rs.close(); sm.close(); ct.close();
} catch (Exception e) { e.printStackTrace(); } }
return map;
}