This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

strange sql syntax error  RSS feed

 
Edgar Har
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends
It would be nice if you could help me to figure out on this.

I have web dynamic project in which my database manager works fine. however when I am writing sql query with inner join and where clause it throws exception by claiming syntax error. running the same query from command line works fine. Cant understand whats wrong. Any help would be very much appreciated.

here is my method in database manager




here is my doGet in controller servlet (at this moment I've tested it with flag).



and here is exception thrown

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 '= 3' at line 1

what am i doing wrong?
 
Karn Kumar
Ranch Hand
Posts: 153
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Query seems fine.. Can you try same query executing in DB . If it is correct then can you try giving space before where and after ? in the query and try to run.

-Chetan
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!