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/05/21 09:02:44 UTC
[GitHub] [shardingsphere] gfYaya opened a new issue #5728: Single schema, single database, how to config spring sharding-jdbc configure files?
gfYaya opened a new issue #5728:
URL: https://github.com/apache/shardingsphere/issues/5728
I'm sorry for that my English is so pool.I would try my best to describe this process.
Here is my spring sharding-jdbc configures.
spring:
#spring sharding jdbc 配置
shardingsphere:
datasource:
names: dataudit
dataudit:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://:3306/jiaanpei_dataudit?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
username:
password:
sharding:
tables:
# janpb_goods_supp_standard_snapshot表分片策略
janpb_goods_supp_standard_snapshot:
table-strategy:
inline:
# 根据companyCode 进行分片
sharding-column: companyCode
algorithm-expression: dataudit.janpb_goods_supp_standard_snapshot_$->{companyCode % 32}
###分表的总数 0到31 janpb_goods_supp_standard_snapshot_0, .... janpb_goods_supp_standard_snapshot_31
actual-data-nodes: dataudit.janpb_goods_supp_standard_snapshot_$->{0..31}
props:
sql:
### 开启分片日志
show: true
the spring sharding-jdbc maven version is 4.0.0.RC2 (The lastest version maybe have a bug that couldn't determine which table it needs).
Then, the console prints that:
2020-05-21 16:54:38.764 [http-nio-7003-exec-1] INFO ShardingSphere-SQL -
Actual SQL: dataudit ::: insert into dataudit.janpb_goods_supp_standard_snapshot_14
......
### Error updating database. Cause: java.sql.SQLSyntaxErrorException: Table 'dataudit.janpb_goods_supp_standard_snapshot_14' doesn't exist.
I have tried too many times to alter the spring sharding-jdbc configures.
1.shardingsphere.datasource.names doesn't support "_" char.
2.algorithm-expression,actual-data-nodes have to need a 'shardingsphere.datasource.names' before the table name. And the datasource schema name couldn't config before the table name directly, such as "jiaanpei_dataudit.janpb_goods_supp_standard_snapshot_$->{companyCode % 32}"
----------------------------------------------------------------
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
[GitHub] [shardingsphere] gfYaya commented on issue #5728: Single schema, single database, how to config spring sharding-jdbc configure files?
Posted by GitBox <gi...@apache.org>.
gfYaya commented on issue #5728:
URL: https://github.com/apache/shardingsphere/issues/5728#issuecomment-631973708

----------------------------------------------------------------
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
[GitHub] [shardingsphere] gfYaya edited a comment on issue #5728: Single schema, single database, how to config spring sharding-jdbc configure files?
Posted by GitBox <gi...@apache.org>.
gfYaya edited a comment on issue #5728:
URL: https://github.com/apache/shardingsphere/issues/5728#issuecomment-631984312
https://github.com/apache/shardingsphere/blob/dev-4.x/examples/sharding-jdbc-example/sharding-example/sharding-spring-boot-jpa-example/src/main/resources/application-sharding-tables.properties

remove the schema before table name for 'algorithm-expression' attribute.
() -> {printf('mission success!')};
----------------------------------------------------------------
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
[GitHub] [shardingsphere] gfYaya commented on issue #5728: Single schema, single database, how to config spring sharding-jdbc configure files?
Posted by GitBox <gi...@apache.org>.
gfYaya commented on issue #5728:
URL: https://github.com/apache/shardingsphere/issues/5728#issuecomment-631984312
https://github.com/apache/shardingsphere/blob/dev-4.x/examples/sharding-jdbc-example/sharding-example/sharding-spring-boot-jpa-example/src/main/resources/application-sharding-tables.properties
----------------------------------------------------------------
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
[GitHub] [shardingsphere] kimmking closed issue #5728: Single schema, single database, how to config spring sharding-jdbc configure files?
Posted by GitBox <gi...@apache.org>.
kimmking closed issue #5728:
URL: https://github.com/apache/shardingsphere/issues/5728
----------------------------------------------------------------
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
[GitHub] [shardingsphere] gfYaya edited a comment on issue #5728: Single schema, single database, how to config spring sharding-jdbc configure files?
Posted by GitBox <gi...@apache.org>.
gfYaya edited a comment on issue #5728:
URL: https://github.com/apache/shardingsphere/issues/5728#issuecomment-631984312
https://github.com/apache/shardingsphere/blob/dev-4.x/examples/sharding-jdbc-example/sharding-example/sharding-spring-boot-jpa-example/src/main/resources/application-sharding-tables.properties

() -> {printf('mission success!')};
----------------------------------------------------------------
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