MySql Data Truncation

Discussion in 'Java' started by Marcelo, Dec 19, 2005.

  1. Marcelo

    Marcelo Guest

    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)
    Marcelo, Dec 19, 2005
    #1
    1. Advertising

  2. Marcelo

    Rhino Guest

    "Marcelo" <> wrote in message
    news:43a5fa8b$...
    > 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
    Rhino, Dec 19, 2005
    #2
    1. Advertising

  3. Marcelo

    Aj-India Guest

    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.
    Aj-India, Dec 19, 2005
    #3
  4. Marcelo

    Roedy Green Guest

    On Mon, 19 Dec 2005 01:10:51 +0100, Marcelo <>
    wrote, quoted or indirectly quoted someone who said :

    >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.
    --
    Canadian Mind Products, Roedy Green.
    http://mindprod.com Java custom programming, consulting and coaching.
    Roedy Green, Dec 21, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. manas

    Text Truncation

    manas, Jul 1, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    505
    Mark Fitzpatrick
    Jul 1, 2005
  2. Replies:
    3
    Views:
    1,246
    Mike Beaty
    Oct 11, 2006
  3. Magix

    truncation warning

    Magix, Aug 5, 2004, in forum: C Programming
    Replies:
    2
    Views:
    2,887
    Ravi Uday
    Aug 5, 2004
  4. Alfonso Morra

    pointer truncation from 'void *' to 'int'

    Alfonso Morra, Jul 24, 2005, in forum: C Programming
    Replies:
    26
    Views:
    1,301
    Steve Summit
    Jul 25, 2005
  5. david

    no warning for data truncation?

    david, Oct 23, 2008, in forum: C Programming
    Replies:
    1
    Views:
    320
    david
    Oct 24, 2008
Loading...

Share This Page