By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,651 Members | 1,368 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,651 IT Pros & Developers. It's quick & easy.

ERROR: String literal not properly closed by a double quote

P: 1
this is a query which works in mysql but does not work in the jsp
Expand|Select|Wrap|Line Numbers
  1. SELECT (@rownum:=@rownum+1) AS pos, fname,lastname,othername,clas,(( tblbot.mtc+tblmot.mtc+tbleot.mtc)/3+ 
  2. (tblbot.eng+tblmot.eng+tbleot.eng)/3 + (tblbot.che+tblmot.che+tbleot.che)/3+
  3. (tblbot.bio+tblmot.bio+tbleot.bio)/3 + (tblbot.phy+tblmot.phy+tbleot.phy)/3+ 
  4. (tblbot.agr+tblmot.agr+tbleot.agr)/3+(tblbot.his+tblmot.his+tbleot.his)/3+ 
  5. (tblbot.fat+tblmot.fat+tbleot.fat)/3+( tblbot.geo+tblmot.geo+tbleot.geo )/3+ 
  6. (tblbot.cre+tblmot.cre+tbleot.cre)/3+ (tblbot.kis+tblmot.kis+tbleot.kis)/3+ 
  7. (tblbot.fre+tblmot.fre+tbleot.fre )/3+(tblbot.lug+tblmot.lug+tbleot.lug )/3+ 
  8. (tblbot.ent+tblmot.ent+tbleot.ent)/3+ (tblbot.com+tblmot.com+tbleot.com)/3 ) AS tot  
  9. FROM tblemp_dtai LEFT JOIN tblbot ON tblbot.employee_id  LEFT JOIN tblmot ON
  10.  tblmot.employee_id LEFT JOIN tbleot ON tbleot.employee_id, (SELECT @rownum:=0) r WHERE 
  11.  tblemp_dtai.employee_id = tblbot.employee_id AND 
  12.  tblemp_dtai.employee_id = tblmot.employee_id AND 
  13.  tblemp_dtai.employee_id = tbleot.employee_id AND clas = 'S.1' ORDER BY tot DESC;
i am new to this sit i have a problem, my query works in mysql but fails in the jsp file reporting an error; String literal not properly clsoed by a double help

regards
Thanks in advance
Mar 30 '13 #1
Share this Question
Share on Google+
1 Reply


10K+
P: 13,264
Most likely you haven't enclosed your SQL in the " quotes properly.

1.) Separate your Java code from your HTML by using a separate Java class to execute the SQL rather than the JSP.
2.) Use a PreparedStatement for the building the query.
Mar 30 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.