You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/06/04 02:18:54 UTC

[GitHub] [shardingsphere] cherrylzhao commented on issue #5886: The database code is utf8, but after proxy is GBK, there is garbled code

cherrylzhao commented on issue #5886:
URL: https://github.com/apache/shardingsphere/issues/5886#issuecomment-638561134


   could not reproduced in my local environment
   ```
   sharding_db=> \encoding
   UTF8
   sharding_db=> insert into t_order(user_id,status) values(100,'初始化');
   INSERT 0 1
   sharding_db=> select * from t_order;
         order_id      | status | user_id
   --------------------+--------+---------
    475008260601020417 | 初始化 |     100
   (1 rows)
   ```
   configuration is official default like this
   
   ```
   schemaName: sharding_db
   
   dataSources:
     ds_0:
       url: jdbc:postgresql://127.0.0.1:5432/demo_ds_0?serverTimezone=UTC&useSSL=false
       username: postgres
       password: postgres
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
     ds_1:
       url: jdbc:postgresql://127.0.0.1:5432/demo_ds_1?serverTimezone=UTC&useSSL=false
       username: postgres
       password: postgres
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
   
   shardingRule:
     tables:
       t_order:
         actualDataNodes: ds_${0..1}.t_order_${0..1}
         tableStrategy:
           inline:
             shardingColumn: order_id
             algorithmExpression: t_order_${order_id % 2}
         keyGenerator:
           type: SNOWFLAKE
           column: order_id
       t_order_item:
         actualDataNodes: ds_${0..1}.t_order_item_${0..1}
         tableStrategy:
           inline:
             shardingColumn: order_id
             algorithmExpression: t_order_item_${order_id % 2}
         keyGenerator:
           type: SNOWFLAKE
           column: order_item_id
     bindingTables:
       - t_order,t_order_item
     defaultDatabaseStrategy:
       inline:
         shardingColumn: user_id
         algorithmExpression: ds_${user_id % 2}
     defaultTableStrategy:
       none:
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org