user1246950 user1246950 - 1 month ago 6
Java Question

getting sql error 1265 and not sure why

getting 1265 error when trying to insert from java app but when trying to insert from phpmyadmin it works fine ?
any idea why?
or how can i tell which one of the field is giving the error

i am runing a java app that input data to a mysql database
the insert is the query about to run befor the error happans
i lookt up this error 1265 its seem to be happaning when trying to input biger value then alloc for filed in the table

but when am runing this string of the insert from phpmyadmin it accept it


enter image description here

insert into delivery (`truckid`, `Factory`, `rangedelivery`, `deliverydate`, `deliveryid`,
`costdocument`, `amount`, `completion`, `sumamount`, `pricelist`, `delivery`,
`standbytime`, `waiting`, `night`, `descriptionextra`, `extension`, `mixing`, `value`)
VALUES ('460', 'N041', '0037', '2016-05-24', '6400439688', '5674250',
'14.00', '0.00', '14.00', '81.57', '1,141.98', '0.00', '0.00', '0.00', '', '0.00', '114.20', '1256.18')
SQLException: Data truncated for column 'delivery' at row 1
SQLState: 01000
VendorError: 1265

Answer

Try remove the comma '1,141.98'

 insert into delivery (`truckid`, `Factory`, `rangedelivery`, `deliverydate`, `deliveryid`, 
    `costdocument`, `amount`, `completion`, `sumamount`, `pricelist`, `delivery`, 
    `standbytime`, `waiting`, `night`, `descriptionextra`, `extension`, `mixing`, `value`) 
    VALUES ('460', 'N041', '0037', '2016-05-24', '6400439688', '5674250',
    '14.00', '0.00', '14.00', '81.57', '1141.98', '0.00', '0.00', '0.00', '', '0.00', '114.20', '1256.18')