What is causing this MySQLSyntaxError exception?
i wrote this query (in java class) to fetch some information from MySQL database and view it in jsp page ...
SELECT instructor .name FROM instructor, section, teach WHERE learn.student_id = '3'AND learn.section = section.number AND section.instructor_id = instructionor.ID
but there is an exception!
javax.servlet.ServletException: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual corresponding to your MySQL server version for the correct syntax to use near '.student_id =' 3'AND learn.section = section.number AND section.instructor_id = ins' on line 1
By the way, I wrote it in PhpMyAdmin and it works.
Application Server: Sun GlassFish Enterprise Server v2.1
Please help me...
Hello
If your request is listed exactly as you show it:
SELECT instructor.name FROM instructor,section,teach WHERE teach.student_id='3'AND
teach.section = section.number AND section.instructor_id= instructor.ID
then you need a space after '3'
and before AND
on the first line shown above.
a source to share
thanks for all
I was writing query in java class like this
ResultSet rs = stmt.executeQuery ("SELECT instructionor.name" + "From the instructor, section, teach" + "WHERE learn.student_id =" + "'" + idd + "'" + "And learn.section = section.number AND section.instructor_id = instructor.ID ");
then i delete all lines and put the query in one line like this, then it solved ...
Hello