Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MySQL Syntax Exception

 
Ketul Parikh
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have following SQL :

UPDATE TABLE_NAME SET FIELD_NAME = FIELD_NAME -1 WHERE ANOTHER_FIELD_NAME= 311;

I get success when i run this query directly from query browser.

However, through my java program, when i create a preparedStatement and call its execute() method it throws following MySQL Syntax Exception.

Other Details :

MySQL Connector Jar - mysql-connector-java-5.1.15-bin.jar
MySQL Version : 5.1
OS : CentOs 5.1
 
Tim McGuire
Ranch Hand
Posts: 820
IntelliJ IDE Tomcat Server VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ketul Parikh wrote:I have following SQL :

UPDATE TABLE_NAME SET FIELD_NAME = FIELD_NAME -1 WHERE ANOTHER_FIELD_NAME= 311;

I get success when i run this query directly from query browser.

However, through my java program, when i create a preparedStatement and call its execute() method it throws following MySQL Syntax Exception.

Other Details :

MySQL Connector Jar - mysql-connector-java-5.1.15-bin.jar
MySQL Version : 5.1
OS : CentOs 5.1


can you post the code where you create the preparedStatement?

and post the Syntax Exception? I think you forgot to paste it in there.
 
Atul Darne
Ranch Hand
Posts: 118
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim McGuire wrote:

can you post the code where you create the preparedStatement?

and post the Syntax Exception? I think you forgot to paste it in there.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic