6 Replies Latest reply on Apr 24, 2003 1:33 AM by ucftcys

    Problem about CMP chinese encoding!!!

    alex.lee

      Dear All:
      I use the jboss+tomcat+mysql, and the mysql Driver is org.mm.mysql.Driver. When use the BMP, the value inserted into the database is chinese, but using the CMP, the value isn't chinese.
      I debug the program, find that the values in ejbCreate() method are right(display chinese), but stored in database those changed "???" or other strange character. When I change the database to MS SQL Server, all these are correct.
      I think it maybe because of the mysql's driver problem or mysql.
      Anyone can give me an hand?

        • 1. Re: Problem about CMP chinese encoding!!!

          Hi (ni hao :)),

          Sounds like a problem with mySQL and character encoding. I haven't used mySQL before, but I believe you can use the parameters:

          1) useUnicode : should the driver use Unicode character encodings when handling strings? (true/false) false
          2) characterEncoding : if useUnicode is true, what character encoding should the driver use when dealing with strings? none

          Are you setting the "useUnicode" parameter in the properties for the datasource that is being used with CMP?

          Luke.

          • 2. Re: Problem about CMP chinese encoding!!!
            alex.lee

            Luke:
            Thank you!
            But the jboss will throw exception in this way!
            Now I had resolve this problem!

            • 3. Re: Problem about CMP chinese encoding!!!
              sophia

              Hi, Alex,

              I've encountered the same problem as you, would you mind telling me how you solved the problem?

              Regards,
              Sophia

              • 4. Re: Problem about CMP chinese encoding!!!
                yaorong

                I have the similar problem. Would you please share your solution?

                • 5. Why donot you present your way
                  ipozeng

                  Hi,
                  As a Chinese i suggest you should present your way.It is not friendly to say i have resolved it !

                  Regards!

                  • 6. Re: Why donot you present your way
                    ucftcys

                    in mysql-service.xml



                    <config-property name="ConnectionURL" type="java.lang.String">jdbc:mysql://localhost:3306/DBName?useUnicode=true&amp;characterEncoding=Big5</config-property>
                    <config-property name="DriverClass" type="java.lang.String">org.gjt.mm.mysql.Driver</config-property>
                    <!--set these only if you want only default logins, not through JAAS -->
                    <config-property name="UserName" type="java.lang.String">name</config-property>
                    <config-property name="Password" type="java.lang.String">password</config-property>