Hi,
Here is the query which I am using to get the values from the database:-
and here is function throught which I am getting data:-
and here is how I am calling this function:-
Now it is throwing Exception:-
i am not able to find what is the problem... STATUS column is there in the table...?
thanks and regards,
madhoriya
Here is the query which I am using to get the values from the database:-
Code:
"SELECT ?, COUNT(*) AS COUNT " + "FROM DEFECT_DETAIL " + "WHERE TARGET_MILESTONE = ? " + "GROUP BY ?";
Code:
public Hashtable getTargetMilestoneDefectCount(String varColumn, String targetM) {
Connection con = null;
ResultSet rs = null;
String str = null;
Hashtable defectCountList = new Hashtable();
try {
con = new MySqlDAOFactory().getConnection();
PreparedStatement pStatement = null;
//passing query to the database
pStatement = con.prepareStatement( GET_TARGET_MILESTONE_DEFECT_COUNT);
System.out.println( GET_TARGET_MILESTONE_DEFECT_COUNT);
pStatement.setString(1, varColumn);
pStatement.setString(2, targetM);
pStatement.setString(3, varColumn);
rs = pStatement.executeQuery();
while(rs.next()) {
System.out.println("Inside while loop");
DefectReportVO defectReportVO = new DefectReportVO();
str = rs.getString(varColumn);
defectReportVO.setCount(rs.getInt("COUNT"));
if(defectReportVO != null) {
defectCountList.put(str, defectReportVO);
}
}
rs.close();//closing result set
pStatement.close();//closing prepared statement
Code:
Hashtable statusCountList = distinctReportsDAO.getTargetMilestoneDefectCount("STATUS", "v.1.24.00");
Code:
java.sql.SQLException: Column 'STATUS' not found. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910) at com.mysql.jdbc.ResultSet.findColumn(ResultSet.java:955) at com.mysql.jdbc.ResultSet.getString(ResultSet.java:5436) at com.spi.defecttracker.dao.DefectReportDAOImpl.getTargetMilestoneDefectCount(DefectReportDAOImpl.java:846) at com.spi.defecttracker.test.testMain.main(testMain.java:52)
thanks and regards,
madhoriya
Comment