I'm trying to store a web page to table "pages" (whether or not that's a 
good idea for a separate thread, please).  What would be a suitable type 
for the field which stores the actual page source?

When running my java application, the MySQL errors are as so:

run:
     [java] [EL Info]: 2014-11-18 01:36:57.574--ServerSession(17148489)--
EclipseLink, version: Eclipse Persistence Services - 
2.5.2.v20140319-9ad6abd
     [java] [EL Info]: connection: 2014-11-18 01:36:58.798--ServerSession
(17148489)--file:/home/thufir/NetBeansProjects/AggregatorJpaClient/build/
classes/_SeleniumIteratorPU login successful
     [java] [EL Warning]: 2014-11-18 01:37:46.084--UnitOfWork(29789888)--
Exception [EclipseLink-4002] (Eclipse Persistence Services - 
2.5.2.v20140319-9ad6abd): 
org.eclipse.persistence.exceptions.DatabaseException
     [java] Internal Exception: com.mysql.jdbc.MysqlDataTruncation: Data 
truncation: Data too long for column 'page' at row 1Exception in thread 
"main" javax.persistence.RollbackException: Exception [EclipseLink-4002] 
(Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): 
org.eclipse.persistence.exceptions.DatabaseException
     [java] Internal Exception: com.mysql.jdbc.MysqlDataTruncation: Data 
truncation: Data too long for column 'page' at row 1
     [java] Error Code: 1406
     [java] 
     [java] Error Code: 1406
     [java] Call: INSERT INTO rome_aggregator.pages (CREATED, link_id, 
PAGE, STATUS) VALUES (?, ?, ?, ?)
     [java]     bind => [4 parameters bound]
     [java] Query: InsertObjectQuery(dur.Page[ id=null ])
     [java] Call: INSERT INTO rome_aggregator.pages (CREATED, link_id, 
PAGE, STATUS) VALUES (?, ?, ?, ?)
     [java]     bind => [4 parameters bound]
     [java] Query: InsertObjectQuery(dur.Page[ id=null ])
     [java]     at 
org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit
(EntityTransactionImpl.java:157)
     [java]     at 
net.bounceme.dur.jpa.controllers.PageJpaController.create
(PageJpaController.java:31)
     [java]     at net.bounceme.dur.jpa.facades.PageFacade.create
(PageFacade.java:22)


and the table structure as so:

mysql> 
mysql> describe pages;
+---------+-----------+------+-----+-------------------
+-----------------------------+
| Field   | Type      | Null | Key | Default           | 
Extra                       |
+---------+-----------+------+-----+-------------------
+-----------------------------+
| id      | int(11)   | NO   | PRI | NULL              | 
auto_increment              |
| created | timestamp | NO   |     | CURRENT_TIMESTAMP | on update 
CURRENT_TIMESTAMP |
| page    | text      | NO   |     | NULL              
|                             |
| link_id | int(11)   | NO   |     | 0                 
|                             |
| status  | int(11)   | NO   |     | 0                 
|                             |
+---------+-----------+------+-----+-------------------
+-----------------------------+
5 rows in set (0.31 sec)

mysql> 
mysql> select * from pages;
Empty set (0.00 sec)

mysql> 

The engine is:

ENGINE=InnoDB DEFAULT CHARSET=latin1


I'll try some different options; thought I'd ask here to see how that 
error is interpreted here.  It seems to me that the String is just too 
large for the field in the database...?


thanks,

Thufir


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql

Reply via email to