4 Replies Latest reply on Feb 21, 2002 1:23 PM by wimflam

    Character encoding (parameters for JDBC driver)

    abrasax

      Hi all,

      I use JBoss 3.0.0 alpha with MySQL and need to set the character encoding as recommended in some posts here (e.g. http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/ but I don't know how to get it work in this version of JBoss.

      I've tried to modify the ConnectionURL in mysqldb-default-service.xml:
      ...
      ConnectionURL=jdbc:mysql://localhost/gis?characterEncoding=Cp1250&useUnicode=true
      DriverClass=org.gjt.mm.mysql.Driver
      UserName=root
      ...

      But I've got an exception. So I've tried to add following attribute:

      ...

      characterEncoding=Cp1250
      useUnicode=true

      ...

      But I've got an exception too.

      What is the correct way to set encoding for CMP in JBoss 3.0?

      Thanx for any answer...

      Martin

        • 1. Re: Character encoding (parameters for JDBC driver)
          davidjencks

          Right now with connections obtained from a Driver implementation (jdbc 1/Local Transaction wrapper) you have to set all such properties in the url. If you were using mysql standalone how would you specify these properties?

          • 2. Re: Character encoding (parameters for JDBC driver)
            abrasax

            I'm not sure if I understand your question well, but the URL should be
            jdbc:mysql://localhost/gis?characterEncoding=Cp1250&useUnicode=true

            This works eg. when I connect from iSQL etc. But JBoss doesn't accept URL in this form. It throws an exception:

            [12:09:33,941,AutoDeployer] Deployment failed:file:/E:/java/jboss/deploy/mysqldb
            -default-service.xml
            org.jboss.deployment.DeploymentException: No valid service.xml file foundNext ch
            aracter must be ";" terminating reference to entity "useUnicode".

            Can you please propose some solution?

            Best regards
            Martin

            • 3. Re: Character encoding (parameters for JDBC driver)
              wimflam

              It's just a stab in the dark, but have you tried this:
              jdbc:mysql://localhost/gis?characterEncoding=Cp1250&useUnicode=true

              The & sign always needs to be escaped in XMl, but using the & entity.

              • 4. Re: Character encoding (parameters for JDBC driver)
                wimflam

                Oops, my advice didn't quite come out properly on the forum.

                The entity is & amp ; only without the spaces: so your URL would be

                jdbc:mysql://localhost/gis?characterEncoding=Cp1250& amp ;useUnicode=true

                (only remove the spaces) :-)