3 Replies Latest reply on Aug 28, 2001 4:51 AM by simons

    Problem when deploying CD example with mySQL

    simons

      [using JBoss 2.4.0beta, mySQL 3.23.40]

      The CD example works fine with the default database.
      But when I use mySQL, I get the following error in the log:

      [JAWS] java.sql.SQLException: Invalid argument value: Too big column length for column 'artist' (max = 255). Use BLOB instead

      BUT I can't see the mistake, "artist" in the CDBean is a java.lang.String and the mySQL mapping in standardjaws.xml maps this to "varchar(255) binary"

      So why does JBoss/JAWS try to create a column with more than 255 characters?

      thanks in advance, michael

        • 1. Re: Problem when deploying CD example with mySQL
          alu1344

          I'm not sure, but quoting the MySQL docs:

          > Values in VARCHAR columns are variable-length strings. You can declare a VARCHAR column to be any length between 1 and 255, just as for CHAR columns. However, in contrast to CHAR, VARCHAR values are stored using only as many characters as are needed, plus one byte to record the length. Values are not padded; instead, trailing spaces are removed when values are stored. (This space removal differs from the ANSI SQL specification.)

          So, for a VARCHAR field, you must be limited to 254 chars.

          JAWS try 255 by default, you'll have to define your own jaws.xml file.

          • 2. Re: Problem when deploying CD example with mySQL
            simons

            That doesn't seem to be the problem. I changed the mapping java.lang.String -> VARCHAR(254) but got the same error:

            [JAWS] java.sql.SQLException: Invalid argument value: Too big column length for column 'artist' (max = 255). Use BLOB instead

            Can I log the mapping that JAWS produces?

            michael

            • 3. SOLVED: Problem when deploying CD example with mySQL
              simons

              I have to apologize!

              I did NOT change the value of <type-mapping> in standardjaws.xml to "mySQL", so JAWS still used the mapping of the Hypersonic database and therefore mapped java.lang.String to VARCHAR(256)!

              Sorry. michael