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/11/26 10:20:34 UTC
[GitHub] [shardingsphere] thinwonton opened a new issue #8362: datasource name using a '_' character is invalid
thinwonton opened a new issue #8362:
URL: https://github.com/apache/shardingsphere/issues/8362
This problem mentioned above happen at the sharding-jdbc version 4.x and 5.0, springboot version 2.1.
It seems that the problem is relation to the springboot version which is responsibility for resoving the configuration name. I soloved the problem with changing the datasource name using '**-**' not the '**_**' .
The config is from the official config example , url is [https://github.com/apache/shardingsphere/blob/4.1.1/examples/sharding-jdbc-example/sharding-example/sharding-spring-boot-mybatis-example/src/main/resources/application-master-slave.properties](url)
my exception message bellows:
![image](https://user-images.githubusercontent.com/6516187/100337428-5182c000-3012-11eb-8c60-f9a44693f235.png)
and the profile is :
`
spring.shardingsphere.datasource.names=ds_master,ds_slave
#主库
spring.shardingsphere.datasource.ds_master.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.ds_master.driver-class-name=com.mysql.cj.jdbc.Driver
spring.shardingsphere.datasource.ds_master.jdbc-url=jdbc:mysql://localhost:3306/sjdbc-master-slave-m?serverTimezone=GMT%2B8&useSSL=false&useUnicode=true&characterEncoding=UTF-8
spring.shardingsphere.datasource.ds_master.username=root
spring.shardingsphere.datasource.ds_master.password=123456
spring.shardingsphere.datasource.ds_master.hikari.connection-init-sql=select 1
#从库
spring.shardingsphere.datasource.ds_slave.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.ds_slave.driver-class-name=com.mysql.cj.jdbc.Driver
spring.shardingsphere.datasource.ds_slave.jdbc-url=jdbc:mysql://localhost:3306/sjdbc-master-slave-s?serverTimezone=GMT%2B8&useSSL=false&useUnicode=true&characterEncoding=UTF-8
spring.shardingsphere.datasource.ds_slave.username=root
spring.shardingsphere.datasource.ds_slave.password=123456
spring.shardingsphere.datasource.ds_slave.hikari.connection-init-sql=select 1
#主从配置
spring.shardingsphere.masterslave.load-balance-algorithm-type=round_robin
spring.shardingsphere.masterslave.name=ds_ms
spring.shardingsphere.masterslave.master-data-source-name=ds_master
spring.shardingsphere.masterslave.slave-data-source-names=ds_slave
`
----------------------------------------------------------------
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] yu199195 commented on issue #8362: datasource name using a '_' character is invalid
Posted by GitBox <gi...@apache.org>.
yu199195 commented on issue #8362:
URL: https://github.com/apache/shardingsphere/issues/8362#issuecomment-734226229
@thinwonton you will see #8299 , in springboot 2.X , maybe use '-' ,not '_'
```
ds-master
ds-slave
```
----------------------------------------------------------------
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 #8362: datasource name using a '_' character is invalid
Posted by GitBox <gi...@apache.org>.
kimmking closed issue #8362:
URL: https://github.com/apache/shardingsphere/issues/8362
----------------------------------------------------------------
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