SDyke Posted May 14, 2008 Share Posted May 14, 2008 I am calling JasperReport from a servlet. I am sending two strings as parameters. The report fails and returns this message: SystemOut O 5/1/2008SystemOut O 5/5/2008 SystemOut O net.sf.jasperreports.engine.JRException: Error preparing statement for executing the report query : Select ftdatem, task, webprddt6.resmngt3.projindex, jobno, assigned, hours2, remhours From webprddt6.resmngt3 Join webprddt6.resmngt2 On webprddt6.resmngt3.projindex = webprddt6.resmngt2.recseq Join webprddt6.resmngt3b On webprddt6.resmngt3b.taskindex = webprddt6.resmngt3.recseq Where deptno = ? And ftdatem >= ? And ftdatem < ? Group By ftdatem, task, webprddt6.resmngt3.projindex, jobno, assigned, hours2, remhours Order By ftdatem This is my Select string: Select ftdatem, task, webprddt6.resmngt3.projindex, jobno, assigned, hours2, remhours From webprddt6.resmngt3 Join webprddt6.resmngt2 On webprddt6.resmngt3.projindex = webprddt6.resmngt2.recseq Join webprddt6.resmngt3b On webprddt6.resmngt3b.taskindex = webprddt6.resmngt3.recseq Where deptno = $P{deptno} And ftdatem >= $P{sd1} And ftdatem < $P{fd1} Group By ftdatem, task, webprddt6.resmngt3.projindex, jobno, assigned, hours2, remhours Order By ftdatem Link to comment Share on other sites More sharing options...
SDyke Posted May 14, 2008 Author Share Posted May 14, 2008 Is anyone able to give any suggestion for this? Link to comment Share on other sites More sharing options...
lshannon Posted May 14, 2008 Share Posted May 14, 2008 You said you are sending two parameters. There are three of them in your query. Does the third parameter have a default value defined in the report. If not then your query is not being properly constructed. Link to comment Share on other sites More sharing options...
SDyke Posted May 14, 2008 Author Share Posted May 14, 2008 Yes. I am sending three prams to the report. I have tested this every way I know how and no success. I changed the two parameters(sd1 and fd1) in the SQL statement to hard coded strings and ran the report with two fields to display the two parameters I am sending and it looks like the values are getting to the report okay. However, tt looks like the SQL statement doesen't interpret the parameters(sd1 and fd1) correctly. Thanks for helping me figure this out. Link to comment Share on other sites More sharing options...
SDyke Posted May 15, 2008 Author Share Posted May 15, 2008 Still really need some help with this. Link to comment Share on other sites More sharing options...
itchytoes Posted May 15, 2008 Share Posted May 15, 2008 Hi -- Try $P!{fd1} and $P!{sd1} and $P!{deptno} I'm not sure if that will solve your problem entirely. Are the fd1 and sd1 date strings with some kind of format? If they are strings, and your SQL will understand the query with the strings you give it, I think you may need single quotes around the $P!{fd1} and $P!{sd1}. I'm not entirely if single quotes are needed, but I always surround my string params with single quotes. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now