private void configureCharsetProperties() throws SQLException {
  if (getEncoding() != null) {
    try {
      String testString="abc";
      StringUtils.getBytes(testString,getEncoding());
    }
 catch (    UnsupportedEncodingException UE) {
      String oldEncoding=getEncoding();
      try {
        setEncoding(CharsetMapping.getJavaEncodingForMysqlCharset(oldEncoding));
      }
 catch (      RuntimeException ex) {
        SQLException sqlEx=SQLError.createSQLException(ex.toString(),SQLError.SQL_STATE_ILLEGAL_ARGUMENT,null);
        sqlEx.initCause(ex);
        throw sqlEx;
      }
      if (getEncoding() == null) {
        throw SQLError.createSQLException("Java does not support the MySQL character encoding '" + oldEncoding + "'.",SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE,getExceptionInterceptor());
      }
      try {
        String testString="abc";
        StringUtils.getBytes(testString,getEncoding());
      }
 catch (      UnsupportedEncodingException encodingEx) {
        throw SQLError.createSQLException("Unsupported character encoding '" + getEncoding() + "'.",SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE,getExceptionInterceptor());
      }
    }
  }
}

private void configureCharsetProperties ( ) throws SQLException { if ( getEncoding ( ) != null ) { try { String testString = "abc" ; StringUtils . getBytes ( testString , getEncoding ( ) ) ; } catch ( UnsupportedEncodingException UE ) { String oldEncoding = getEncoding ( ) ; try { setEncoding ( CharsetMapping . getJavaEncodingForMysqlCharset ( oldEncoding ) ) ; } catch ( RuntimeException ex ) { SQLException sqlEx = SQLError . createSQLException ( ex . toString ( ) , SQLError . SQL_STATE_ILLEGAL_ARGUMENT , null ) ; sqlEx . initCause ( ex ) ; throw sqlEx ; } if ( getEncoding ( ) == null ) { throw SQLError . createSQLException ( "Java does not support the MySQL character encoding '" + oldEncoding + "'." , SQLError . SQL_STATE_INVALID_CONNECTION_ATTRIBUTE , getExceptionInterceptor ( ) ) ; } try { String testString = "abc" ; StringUtils . getBytes ( testString , getEncoding ( ) ) ; } catch ( UnsupportedEncodingException encodingEx ) { throw SQLError . createSQLException ( "Unsupported character encoding '" + getEncoding ( ) + "'." , SQLError . SQL_STATE_INVALID_CONNECTION_ATTRIBUTE , getExceptionInterceptor ( ) ) ; } } } }
configures client - side properties for character set information .
