Im getting this on just about every line....anybody see what Im doing wrong?

public static int[] getLeadsSummary(UserDataVO userData) throws Exception {
    Connection connection	= null;
    PreparedStatement pstmt	= null;
    ResultSet resultSet		= null;
    int[] leadsSummary = {0,0};
    int leadCount = 0;
    
    try {
        connection = DataBaseConnectionManager.getConnection();
        if (connection != null) {
                if (userData.isAgentType()) {
                    String sqlStmt = "SELECT distinct count (lc.con_id) as TotalLeads FROM LEADS L inner join leads_contactinfo lc on l.fk_conid = lc.con_id" +
                    " WHERE l.FK_CONID = lc.CON_ID AND lc.FK_AGENTID = ? AND L.BO_VIEWED = 0 ";
//                    logger.debug(sqlStmt);
                    pstmt = connection.prepareStatement(sqlStmt);
                    pstmt.setInt(1,userData.getAgentId());
                    resultSet = pstmt.executeQuery();
                    if (resultSet.next()) {
                        leadsSummary[0] = resultSet.getInt(1);
                    }
                    resultSet.close();
                    pstmt.close();
                    
                    // Do it again
                    
                } else {
                    String sqlStmt = "SELECT count(*) FROM leads l, leads_contactinfo lc " +
            		" WHERE l.FK_CONID = lc.CON_ID AND lc.FK_ADVERID = ? " + 
                    " AND l.TIME_STAMP > TO_DATE('" + Integer.toString(month) + "/" + 
                    Integer.toString(i+1) + "/" + Integer.toString(year) + " 00:00','MM/DD/YYYY HH24:MI') AND " + 
                    " l.TIME_STAMP < TO_DATE('" + Integer.toString(month) + "/" + 
                    Integer.toString(i+1) + "/" + Integer.toString(year) + " 23:00','MM/DD/YYYY HH24:MI')";
//                    logger.debug(sqlStmt);
                    pstmt = connection.prepareStatement(sqlStmt);
                    pstmt.setInt(1,userData.getAdverId());
                    resultSet = pstmt.executeQuery();
                    if (resultSet.next()) {
                        leadCount = resultSet.getInt(1);
                    }
                    resultSet.close();
                    pstmt.close();
                }
            }
    }catch (SQLException e) {
        throw new Exception(e);
    }catch(Exception e){
        throw new Exception(e);
    } finally {
        try {
            if (resultSet!=null) resultSet.close();
            if (pstmt!=null) pstmt.close();
            DataBaseConnectionManager.closeConnection(connection);
        }  catch (SQLException e) {
            throw new Exception(e);
        }catch(Exception e){
            throw new Exception(e);
        }
    }

    return leadsSummary;
}

Recommended Answers

All 4 Replies

Can U please post the error what u get

sure....
class, interface, or enum expected
[javac] public static int[] getLeadsSummary(UserDataVO userData) throws Exception {

I am not clear about the problem yet. But seems like you did not declare any class.
In java, almost e'thing is an object. So in order to make your function work, you have to put it inside an object.
sample solution can be:

public class MyClassName
{
public static int[] getLeadsSummary(UserDataVO userData) throws Exception {
/**
*
*all codes inside
*/
}
}

thanx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.