Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2006

Tip: Looking for answers? Try searching our database.

com.mysql.jdbc.MysqlDataTruncation

Thread view: 
cmk128@hotmail.com - 28 Oct 2006 05:35 GMT
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 (cmk128@hotmail.com)
Manish Pandit - 28 Oct 2006 22:08 GMT
> 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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.