using mysql function select now() with jdbc driver

I am trying to execute the following mysql query using jdbc driver.

query:-

UPDATE cp_game_config SET end_date=(SELECT NOW()+500) WHERE STATUS='buddy.created' ORDER BY start_date DESC LIMIT 1;

the query is working effectively when i run it through sqlyog.

but my objective is to run the query using jdbc driver.

i have build a string called query builder.

the value of query builder is:

UPDATE cardplay_poker.cp_game_config SET end_date= '(SELECT NOW()+500)'where STATUS= 'buddy.created' ORDER BY start_date DESC LIMIT 1

but when i am running the program it throws error:

com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '(SELECT NOW()+500)' for column 'end_date'

please help....

Read More »

By: StackOverFlow - 7 days ago

Related Posts