Inserting System Date into Table
Hi,
I am having a problem inserting a system date into a table. I am currently using Mysql. Please find code below.
ins1="INSERT INTO USERS VALUES("
+ "'" + g_user_name + "'" + ","
+ "'" + g_user_password + "'" + ","
+ "'" + g_user_email + "'" + ","
+ "'" + g_user_phone + "'" + ","
+ "'" + g_user_address + "'" + ","
+ "'" + g_user_type + "'" + ","
+ "\'NOW\')";
InsertSQL(ins1, res);
When i run the servlet, I get the following error:
EXCEPTION com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect date value: 'NOW()' for column 'sys_creation_date' at row 1
Please can someone assist.
I have tried different variations as to use the NOW() function. I have also tried to use CURRENT_DATE(). If i do a manual insert into the DB from command prompt, it works perfectly. But when using the servlet, i get the above error.
Thanks Guys ...
Naren

