7 Replies Latest reply on Feb 20, 2003 6:03 AM by laurent.wozniak

    MySql Datasource Encoding

    winsome_zhong

      Hi,I'm a Chinese,so I use gb2312,when I connecting mysql with jdbc directly,I can specified encoding in the URL:

      jdbc:mysql://localhost/test?useUnicode=true&
      characterEncoding=gb2312


      while,when I config a XADatasource in the mysql-service.xml,and try to specify the encoding as this:



      <config-property name="XADataSourceProperties" type="java.lang.String">URL=jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&amp;characterEncoding=gb2312</config-property>
      <config-property name="XADataSourceClass" type="java.lang.String">com.mysql.jdbc.jdbc2.optional.MysqlXaDataSource</config-property>

      it can not work.the console message is:

      [XAManagedConnectionFactory]
      No setter method for attribute
      true&characterEncoding (value=gb2312).


      who can tell me how to specify the encoding of the MySQl XADatasouce in the mysql-server.xml,or,are there any other solution?

        • 1. Re: MySql Datasource Encoding
          azur

          It looks like its reading the rest of the line without parsing the &-sign... Try separating with spaces or something that JBoss recognises as a valid separator.

          Hope it helps. /AzUr

          • 2. Re: MySql Datasource Encoding
            winsome_zhong

            the space can not work too,the warning is same as before

            • 3. Re: MySql Datasource Encoding
              winsome_zhong

              anybody help me??

              • 4. Re: MySql Datasource Encoding
                hkleo

                Try this

                <config-property name="XADataSourceProperties" type="java.lang.String"><![CDATA[jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=gb2312]]></config-property>

                If it does not work, try this

                <config-property name="XADataSourceProperties" type="java.lang.String"><![CDATA[jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8]]></config-property>

                Cheers,
                Leo Tai

                • 5. Re: MySql Datasource Encoding
                  winsome_zhong

                  can not work

                  • 6. Re: MySql Datasource Encoding
                    laurent.wozniak

                    Hello,

                    Got the same problem using encoding latin1.
                    Solved by replacing &amp; by &amp;amp; in jdbc url.

                    I use jboss 3.0.4 (works also fine with 2.4.3 using another syntax)



                    <config-property name="ConnectionURL" type="java.lang.String">jdbc:mysql://myserver:3306/mydb?useUnicode=true&amp;amp;characterEncoding=latin1</config-property>


                    try this:

                    <config-property name="XADataSourceProperties" type="java.lang.String">URL=jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&amp;amp;characterEncoding=gb2312</config-property>

                    By the way, which version of jboss are you using (your config syntax is different from mine) ?


                    I had a dream ... the syntax stops changing ...

                    Cheers,
                    Laurent

                    • 7. Re: MySql Datasource Encoding
                      laurent.wozniak

                      Hello,

                      Got the same problem using encoding latin1.
                      Solved by replacing &amp; by &amp;amp; in jdbc url.

                      I use jboss 3.0.4 (works also fine with 2.4.3 using another syntax)



                      <config-property name="ConnectionURL" type="java.lang.String">jdbc:mysql://myserver:3306/mydb?useUnicode=true&amp;amp;characterEncoding=latin1</config-property>


                      try this:

                      <config-property name="XADataSourceProperties" type="java.lang.String">URL=jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&amp;amp;characterEncoding=gb2312</config-property>

                      By the way, which version of jboss are you using (your config syntax is different from mine) ?


                      I had a dream ... the syntax stops changing ...

                      Cheers,
                      Laurent