标签:lang query rom 结构 statement catch 避免 ace tco
private static List<List<Object>> list = new ArrayList<List<Object>>();public static String queryAll() {Connection conn = null;Statement sta = null;ResultSet rs = null;try {PhoenixDB pDB = new PhoenixDB();conn = pDB.getConn();sta = conn.createStatement();rs = sta.executeQuery("select * from tb");ResultSetMetaData md = rs.getMetaData(); //获得结果集结构信息,元数据int columnCount = md.getColumnCount(); //获得列数while (rs.next()) {List<Object> l = new ArrayList<Object>();for (int i = 1; i <= columnCount; i++) {l.add(rs.getObject(i));}list.add(l);}} catch (SQLException e) {e.printStackTrace();}return "success";}
标签:lang query rom 结构 statement catch 避免 ace tco
原文地址:http://www.cnblogs.com/mario-nb/p/6485249.html