1 Reply Latest reply on Jan 13, 2004 11:23 AM by Adrian Brock

    Charset parameters for MySQL Connector/J driver

    Stjepan Brbot Newbie

       

      "sbrbot" wrote:
      "sbrbot" wrote:
      I'd like to ask how to define which charset will be used for Connector/J driver for MySQL database. According to Connector/J documentation it has useUnicode (must be set on true) and characterEncoding (defining particular encoding type) parameters defining the caracter set being used by driver but how to define it in mysql-ds.xml file?

      If I define like (according to documentation):
      <?xml version="1.0" encoding="UTF-8"?>
      <datasources>
       <local-tx-datasource>
       <jndi-name>MySqlDS</jndi-name>
       <connection-url>jdbc:mysql://brby:3306/jbossdb?useUnicode=true&characterEncoding=Cp1250</connection-url>
       <driver-class>com.mysql.jdbc.Driver</driver-class>
       <user-name>sbrbot</user-name>
       <password>pass</password>
       </local-tx-datasource>
      </datasources>

      I got an error!
      If I define like:
      <?xml version="1.0" encoding="UTF-8"?>
      <datasources>
       <local-tx-datasource>
       <jndi-name>MySqlDS</jndi-name>
       <connection-url>jdbc:mysql://brby:3306/jbossdb</connection-url>
       <driver-class>com.mysql.jdbc.Driver</driver-class>
       <user-name>sbrbot</user-name>
       <password>pass</password>
       <useUnicode>true</useUnicode>
       <characterEncoding>Cp1250</characterEncoding>
       </local-tx-datasource>
      </datasources>
      it does not work! It seems that driver does ignore additional setting about ancoding!