Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Data too long for column error but it should fit(Getting error when trying to insert string of 115 chars into a VARCHAR(750) on mysql)
Data too long for column error but it should fit [message #1784605] Fri, 30 March 2018 07:24
David Badia is currently offline David BadiaFriend
Messages: 2
Registered: June 2016
Junior Member
I have a VARCHAR(750) column but when I try to insert a value of length 115 I get the following error

Quote:
2018-03-30 03:10:21:725 -0400 [https-openssl-nio-8413-exec-11] ERROR SqrlServerOperations - "GRC SQRL Client" 1 QUERY:: Generate exception processing SQRL request: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.3.v20160428-59c81c5): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'value' at row 1
Error Code: 1406
Call: INSERT INTO sqrl_used_nut_token (value, expiryTime) VALUES (?, ?)
bind => [ApMX5RP_iLYmX9lWrTpd-d8zhNPOiquDkdmRim031olXceHPzOJcIkVUpuEvGAj4h-Ra7aE39Y4hfY4YPXQo72yxvFeVoHthpcofoWk3dYgya8y9LA, 2018-03-30 03:25:13.241]
Query: InsertObjectQuery(com.github.sqrlserverjava.persistence.SqrlUsedNutToken@2a2b83f5) of sqrlClientOnRequest "GRC SQRL Client" 1 QUERY:: params: nut=[ApMX5RP_iLYmX9lWrTpd-d8zhNPOiquDkdmRim031olXceHPzOJcIkVUpuEvGAj4h-Ra7aE39Y4hfY4YPXQo72yxvFeVoHthpcofoWk3dYgya8y9LA] cor=[Ksdqbl422DROCVOrjUqHeBPi7q4in97zdTbSNKTWZsI] client=[dmVyPTENCmNtZD1xdWVyeQ0KaWRrPUtEak1yWjdua29qcEFQTkZ0MmFMbGpWaTJCVUhXeXdmbFQxR2o2bXFYYXMNCnBpZGs9OWp1S1BoTXlVMDBjcXhxa2lWeXczeHkzZHllaHl0UGdDV1N5Rk5qS2tpbw0Kb3B0PXN1aw0K] server=[c3FybDovL2xvY2FsaG9zdC5jb206ODQxMy9zcXJsZXhhbXBsZS9zcXJsYmM_bnV0PUFwTVg1UlBfaUxZbVg5bFdyVHBkLWQ4emhOUE9pcXVEa2RtUmltMDMxb2xYY2VIUHpPSmNJa1ZVcHVFdkdBajRoLVJhN2FFMzlZNGhmWTRZUFhRbzcyeXh2RmVWb0h0aHBjb2ZvV2szZFlneWE4eTlMQSZjb3I9S3NkcWJsNDIyRFJPQ1ZPcmpVcUhlQlBpN3E0aW45N3pkVGJTTktUV1pzSQ] ids=[kg4lP0hLNgt31Sv4mtqCcIhnnb5OPzmp5P2xZ3cZmxmYKAXDFfIwcci1bzGdPK4Xw-YRrLuAKm-_m1w38uT5Cg] pids=[H_Vm3KNVvitCcCEQINy0DSlXagjBPRqOXdfFQxPeqlNWBqjzuP9igocPvu42qb0pbYMiT_GMQeSM4TvjlfNbAA]
javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.3.v20160428-59c81c5): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'value' at row 1
Error Code: 1406
Call: INSERT INTO sqrl_used_nut_token (value, expiryTime) VALUES (?, ?)
bind => [ApMX5RP_iLYmX9lWrTpd-d8zhNPOiquDkdmRim031olXceHPzOJcIkVUpuEvGAj4h-Ra7aE39Y4hfY4YPXQo72yxvFeVoHthpcofoWk3dYgya8y9LA, 2018-03-30 03:25:13.241]
Query: InsertObjectQuery(com.github.sqrlserverjava.persistence.SqrlUsedNutToken@2a2b83f5)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:879)
at org.eclipse.persistence.internal.jpa.QueryImpl.performPreQueryFlush(QueryImpl.java:967)
at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:207)
at org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:473)
at com.github.sqrlserverjava.persistence.SqrlJpaPersistenceProvider.fetchSqrlIdentity(SqrlJpaPersistenceProvider.java:88)
at com.github.sqrlserverjava.persistence.SqrlJpaPersistenceProvider.doesSqrlIdentityExistByIdk(SqrlJpaPersistenceProvider.java:74)
at com.github.sqrlserverjava.persistence.SqrlAutoCloseablePersistence.doesSqrlIdentityExistByIdk(SqrlAutoCloseablePersistence.java:51)
at com.github.sqrlserverjava.backchannel.SqrlClientRequestProcessor.processClientCommand(SqrlClientRequestProcessor.java:62)
at com.github.sqrlserverjava.SqrlClientFacingOperations.handleSqrlClientRequest(SqrlClientFacingOperations.java:122)
at com.github.sqrlserverjava.example.sqrl.SqrlBackchannelServlet.doPost(SqrlBackchannelServlet.java:42)


My table was created with:
Quote:
CREATE TABLE sqrl_used_nut_token (value VARCHAR(750) NOT NULL, expiryTime DATETIME NOT NULL, PRIMARY KEY (value));
ALTER TABLE `sqrl_used_nut_token` ADD UNIQUE INDEX(`value`);

(as i type this I suppose the INDEX is redundant)

And my manual insertion via MySQL Workbench works OK

Quote:
INSERT INTO sqrl_used_nut_token (value, expiryTime) VALUES (
'ApMX5RP_iLYmX9lWrTpd-d8zhNPOiquDkdmRim031olXceHPzOJcIkVUpuEvGAj4h-Ra7aE39Y4hfY4YPXQo72yxvFeVoHthpcofoWk3dYgya8y9LA'
, '2018-03-30 03:25:13.241')



I am stumped :)
TIA
Dave
Previous Topic:EclipseLink 2.6 Long Primary Key Mapping PostgreSQL
Next Topic:History Policy
Goto Forum:
  


Current Time: Tue Nov 13 22:26:37 GMT 2018

Powered by FUDForum. Page generated in 0.01806 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top