0 Replies Latest reply on Jan 11, 2004 2:42 PM by sbrbot

    Charset parameters for MySQL Connector/J driver

    sbrbot

       

      "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>...</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>...</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!