java.sql.SQLException: Data truncated for column at row 1

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bsonline
    New Member
    • Oct 2007
    • 21

    java.sql.SQLException: Data truncated for column at row 1

    Hi all,

    When I update a table by sql qry, I am getting a error like "java.sql.SQLEx ception: Data truncated for column [column_name] at row 1" . I use mysql 4.1 for my application.
    this particular column is in varchar with length 10.

    Can anyone help regarding this??
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Most likely you attempted to store a String with more than ten characters in
    that column.

    kind regards,

    Jos

    Comment

    • bsonline
      New Member
      • Oct 2007
      • 21

      #3
      Originally posted by JosAH
      Most likely you attempted to store a String with more than ten characters in
      that column.

      kind regards,

      Jos

      But the data is exactly of 9 character and its constant.

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by bsonline
        But the data is exactly of 9 character and its constant.
        I don't use mysql myself but I suspect that a char in a varchar is an eight bit
        quantity and Java's char is a 16 bit quantity; some encoding is happening
        (most likely). Try to change your table column to varchar 20 or so and see
        what happens.

        kind regards,

        Jos

        Comment

        • sonikaa
          Banned
          New Member
          • Mar 2022
          • 1

          #5
          Java is one of the most generally used programming languages, and it is utilized as the server-side language for a vast of back-end development projects, including big data and Android development. Java is also commonly used in desktop and mobile computing, games, and numerical calculation. Java is an object-oriented programming language with a high level of abstraction and as few implementation dependencies as possible. Java classes in Pune

          Comment

          Working...