Re: MySQLSyntaxErrorException (?)
Posted by: Jonathan Stephens
Date: August 07, 2015 02:48AM

Hi!

MySQLSyntaxError means *exactly* what it sounds like: you're attempting to send an invalid SQL statement to MySQL.

Your problem appears to be here, where I've highlighted the problem point in boldface:

private static final String SQL_INSERT_PROJECT = 
	"INSERT INTO projects (projectnumber, project, activity, per_number, date, time " 
			+ "VALUES (?, ?, ?, ?, ?, ?)";

You're missing a closing parenthesis (that is, a ')' character) following "time".

If you look at the error message carefully, it even tells you where to start looking for the error:

Quote

check the manual that corresponds to your MySQL server version for the right syntax to use near
'VALUES ('p10001', 'TimeKeeper', 'DAOTest', '100101', '2015-08-05', '05:30:00')'

In such cases, "near" usually means "immediately before".

TIP: A good way to find such errors is to print the querystrings out to the screen, so you can see what you're actually trying to send to the MySQL server.

HTH!

cheers,

Jon Stephens
MySQL Documentation Team @ Oracle
Orlando, Florida, USA

MySQL Dev Zone
MySQL Server Documentation
Oracle

Options: ReplyQuote


Subject
Written By
Posted
August 07, 2015 02:24AM
Re: MySQLSyntaxErrorException (?)
August 07, 2015 02:48AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.