com.mysql.jdbc.MysqlDataTruncation

C

cmk128

Hi
I am trying to insert my file content to the DB, i am trying to
insert 1000 files, but when inserting some of the file, i got an
exception, why?

com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data truncated for
column 'content' at row 1
at
com.mysql.jdbc.SQLError.convertShowWarningsToSQLWarnings(SQLError.java:709)
at
com.mysql.jdbc.MysqlIO.scanForAndThrowDataTruncation(MysqlIO.java:3461)
at
com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1198)
at
com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:677)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1357)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1274)
at
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1259)

The file that cause the exception is arround 85KB. and here is the
table structure:

CREATE TABLE `articles` (
`id` int(11) NOT NULL auto_increment,
`major` text NOT NULL,
`minor` text NOT NULL,
`author` text NOT NULL,
`url` text NOT NULL,
`topic` text NOT NULL,
`content` text NOT NULL,
`filename` text NOT NULL,
`filesize` int(11) NOT NULL default '0',
`date` datetime NOT NULL default '0000-00-00 00:00:00',
`rank` int(11) NOT NULL default '0',\n PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=gb2312


thanks
from Peter ([email protected])
 
M

Manish Pandit

The file that cause the exception is arround 85KB. and here is the
table structure:

MySQL text field type can take 64k - so I guess thats where the problem
lies. You might want to replace the content column with something like
a clob or blob.

-cheers,
Manish
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,072
Latest member
trafficcone

Latest Threads

Top