This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
hi, May be this is not the right forum for the following question regarding mysql but if one can check it out for me it is great. I am using mysql and JDBC for some application that uses the jakarta struts frame work. mysql works fine with a lot of insert, delete, and what not but when i am trying to update I get some error which has already costed me many hours. Here is some details that might help you help me in detecting this problem.
upon execution i get the following error: Syntax error or access violation, message from server: "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'where student_id = "xxxxxxxx".
where "xxxxxxxx" is a wrong value for student_id. What syntax error in mysql could be causing this? Thank you, in advance, for trying to help. Lee
You have "qlString.append" instead of "sqlString.append". Also, student_id in the table is a varchar. Does personal.getStudentId() return a String?
IBM 286, SCJP, SCWCD, EIEIO
Joined: Mar 30, 2005
hi guys, Philip asked " Have you tested the UPDATE statement in a query tool, such as the mysql command line utility?" Answer: of course, it works nicely and as expected. In fact I have a similar example that works on a different database and works correctly(except that this has many attributs).
Question:"Beyond that, are you certain personal.getStudentID() returns a value?" Answer: yet personal.getStudentID() return a String.
Rick asked : "Also, student_id in the table is a varchar. Does personal.getStudentId() return a String? " Answer: yes, personal.getStudentId() returns a String.
And the "qlString.append" was a typo error otherwise it is"sqlString.append" in the java code.
Thank you guys and would appreciate further comments or suggestions to the original problem. Have a good day. Lee
Joined: Dec 17, 2002
You have your column orders mixed up. The update statement order is last_name/middle_name/first_name/gender/email one/email two/... but when you do the pstmt.setString's, your order is last_name/middle_name/first_name/email one/email two/gender...
Changing your gender that way isn't allowed, even in Massachusetts!
Joined: Mar 30, 2005
hi guys, Rick you are funny man. I got the error and was able to solve it. It definitely was in the mix-up of things and the major one was
and I honestly do not know how I messed that one up. But anyways thank you guys for trying to help as usual. if any body wants the whole list of codes regarding this and how I corrected it, let me know and I will post most of it.