日期:2014-05-20 浏览次数:21189 次
public int getTrackingInfo() { int rowcount = 0; DBOperator dbOpr = new DBOperator("sqlserver"); String table = "TrackingEvent_" + SemUtil.getDateTime(new Date(currentTime - 4 * oneHour), "yyyyMM"); String sql = "SELECT count(*) as count FROM " + table + " where evtdatetime>=? and evtdatetime<?"; PreparedStatement ps = dbOpr.getPreparedStatement(sql); ResultSet rs = null; try { ps.setString(1, startTime); ps.setString(2, endTime); rs = ps.executeQuery(); if (rs.next()) { rowcount = rs.getInt("count"); } rs.close(); ps.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); try { rs.close(); ps.close(); } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } }catch (Exception e){ System.out.println("trackingEvents timeout error"); } return rowcount; }