MySql Data Truncation

M

Marcelo

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)
 
R

Rhino

Marcelo said:
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)

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
 
A

Aj-India

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.
 
R

Roedy Green

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.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top