Author
SQL Exception
shumani edzani
Greenhorn
Joined: Oct 03, 2008
Posts: 9
posted Oct 06, 2008 06:57:00
0
i have written this code in the hope of producing a chart but its throwing SQL Exception please help public ActionForward deptChart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { try { ReportWizardForm wizForm = (ReportWizardForm) form; Formatting df = new Formatting(); String appraiser = ""; String appraisee = ""; if (wizForm.getAppraisee() != null && !wizForm.getAppraisee().equals("")) { appraisee = wizForm.getAppraiseeID(); } if (wizForm.getAppraiser() != null && !wizForm.getAppraiser().equals("")) { appraiser = wizForm.getAppraiserID(); } String startdate = ""; if (wizForm.getStartdate() != null) { startdate = AppConstants.BEGINNING_DATE; } else { startdate = df.toNewDate(wizForm.getStartdate()); wizForm.setStartdate(startdate); } String enddate = ""; if (wizForm.getEnddate() != null || wizForm.getEnddate().equals("31 December 3000")) { enddate = AppConstants.AMEN_DATE; } else { enddate = df.toNewDate(wizForm.getEnddate()); wizForm.setEnddate(enddate); } String score = wizForm.getScore(); // String frameworkID = wizForm.getFrameworkID(); String[] department = wizForm.getDepartment(); String scoreoperand = wizForm.getGreaterThan(); String orgId = wizForm.getOrganizationID(); AppraisalDto appDTO = new AppraisalDto(); AppraisalDAO appDAO = new AppraisalDAO(); appDTO.setGreaterThan(scoreoperand); appDTO.setScorevalue(Float.valueOf(score)); appDTO.setAppraiseeid(appraisee); appDTO.setAppraiserid(appraiser); appDTO.setStates(wizForm.getAppraisalphase()); appDTO.setFirstupdated(Timestamp.valueOf(startdate)); appDTO.setLastupdated(Timestamp.valueOf(enddate)); // appDTO.setFrameworkid(frameworkID); appDTO.setDepartments(department); appDTO.setOrgId(orgId); String appIDs = appDAO.reportWizardAppraisals(appDTO); if (appIDs != null && !appIDs.equals("") && !appIDs.equals("'")) { renderChart(appIDs, request, response); } else { return mapping.findForward("noResults"); } wizForm.reset();
Sagar Rohankar
Ranch Hand
Joined: Feb 19, 2008
Posts: 2896
posted Oct 06, 2008 07:13:00
0
The best way solve any run time exception is to catch hem and print stack trace , which shows part of code with line number which has problem , also the the exception comes with message , which itself explains a lot !! So post the exception message with line no at which its throwing it !!
[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
posted Oct 06, 2008 07:34:00
0
I don't think this is related to SCJP in any way...
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12929
posted Oct 07, 2008 04:50:00
0
Double post . Please carefully choose one forum when you post a question on JavaRanch.
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
subject: SQL Exception