0
votes

I'm trying to connect my play2.4 application to a MySQL database. Upon applying an evolution I get the following error

We got the following error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(6), pickup_date datetime(6), delivery_date datetime(6' at line 14 [ERROR:1064, SQLSTATE:42000], while trying to run this SQL script:

When I check php myadmin I see that all the tables are created until this one is reached:

create table delivery (
id                        bigint auto_increment not null,
deleted                   tinyint(1) default 0,    
description               varchar(500),  
notes                     varchar(1000),
account_id                bigint,
customer_id               bigint,
sender_id                 bigint, 
recipient_id              bigint,
delivery_status_id        bigint,
delivery_type_id          bigint,
package_type_id           bigint,
item_type_id              bigint,
call_date                 datetime(6),
pickup_date               datetime(6),
delivery_date             datetime(6),
no_of_pieces              integer,
cust_type                 integer,
payment_type              integer,
way_bill                  integer,  
created_time              datetime(6),
modified_time             datetime(6),
createdby_id              bigint,
modifiedby_id             bigint,
version                   datetime(6) not null,
constraint pk_delivery primary key (id))

Based on that I'm guessing the error happens when this table is being created but I've been unable to find a reason as to why their would be an error here.

2

2 Answers

0
votes

DateTime does not have a size. It's just datetime.

call_date                 datetime,
pickup_date               datetime,
delivery_date             datetime,
...
created_time              datetime,
modified_time             datetime,
...
version                   datetime not null,
0
votes

The problem was I was using java.util.Date rather than java.sql.Date