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 / December 2005

Tip: Looking for answers? Try searching our database.

MySql Data Truncation

Thread view: 
Marcelo - 19 Dec 2005 00:10 GMT
Hello,

I am getting the MysqlDataTruncation exception, and i do not know why.
I have tried to enter data automaticly from my java program, but from time to
time I get this error.

do you have an idea?

thanks

Marcelo

com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data truncated for column
'url' at row 1
    at com.mysql.jdbc.SQLError.convertShowWarningsToSQLWarnings(SQLError.java:709)
    at com.mysql.jdbc.MysqlIO.scanForAndThrowDataTruncation(MysqlIO.java:3408)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1802)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:2972)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:2902)
    at com.mysql.jdbc.Statement.execute(Statement.java:529)
    at tools.SQLTools.runSQL(SQLTools.java:34)
    at tools.SQLTools.insertURL(SQLTools.java:44)
    at extraction.DumpImages.fillSQLTables(DumpImages.java:86)
    at extraction.DumpImages.dumpFromURL(DumpImages.java:76)
    at extraction.DumpImages.run(DumpImages.java:39)
Rhino - 19 Dec 2005 04:50 GMT
> Hello,
>
[quoted text clipped - 24 lines]
> at extraction.DumpImages.dumpFromURL(DumpImages.java:76)
> at extraction.DumpImages.run(DumpImages.java:39)

It's very hard to diagnose a problem within code with only the error
message; we could be more helpful if you included the code that you executed
to get this message. A definition of the table would also be very helpful.

I've never had this particular error in MySQL so I can only make one guess,
but it may be completely wrong. _Perhaps_ you are trying to put too much
data into the column. For example, if your 'url' column is defined as
CHAR(50) and you are doing an Insert that contains a URL which is more than
50 characters, I would expect an error like this. But I don't know if you
are even doing an Insert; you haven't given us your code. An Update might
experience the same problem if you tried to change an existing URL to one
that was longer than the column allows. Even a Select can experience
truncation in some cases.

I'm not going to speculate any further without more information.

Rhino
Aj-India - 19 Dec 2005 10:39 GMT
Its because the column url in your table that has a fixed length and
the data you are inputting is exceeding that length. Try to change the
data type of the column to text or allocate more space for this column.
Roedy Green - 21 Dec 2005 01:29 GMT
>time I get this error.
>
>do you have an idea?
looks like the problem is here.
    at extraction.DumpImages.fillSQLTables(DumpImages.java:86)

how about you show us some code.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.



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



©2009 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.