public java.util.ArrayList queryRecord(String sqlQueryStmt) {
java.util.ArrayList rows = new java.util.ArrayList();
java.sql.Connection conn = null;
java.sql.Statement stmt = null;
java.sql.ResultSet rs = null;
try {
conn = this.getConnection(10000);
stmt = conn.createStatement();
rs = stmt.executeQuery(sqlQueryStmt);
ResultSetMetaData rsmd = rs.getMetaData();
int columnCount = rsmd.getColumnCount();
while (rs.next()) {
HashMap row = new HashMap();
for (int i = 1;
i <= columnCount;
i++) {
String cname = rsmd.getColumnName(i);
row.put(cname, rs.getObject(i));
}
rows.add(row);
}
return rows;
}
catch (Exception e) {
return null;
}
finally {
try {
rs.close();
stmt.close();
//关闭连接,返回连接
this.freeConnection(conn);
conn = null;
}
catch (Exception e) {
return rows;
}
}
}