File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes MySQL Syntax Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "MySQL Syntax Exception" Watch "MySQL Syntax Exception" New topic
Author

MySQL Syntax Exception

Ketul Parikh
Greenhorn

Joined: Jul 17, 2009
Posts: 14
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

KETUL
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

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

Joined: Jul 05, 2009
Posts: 118

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.


Regards, Atul.
I came to this world on a Learner's License
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MySQL Syntax Exception