jameszhongsq opened a new issue #6657:
URL: https://github.com/apache/shardingsphere/issues/6657
#version
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>sharding-jdbc-spring-boot-starter</artifactId>
<version>4.0.0-RC1</version>
</dependency>
#This is the properties configuration
spring.shardingsphere.datasource.names=m1
spring.main.allow-bean-definition-overriding=true
spring.shardingsphere.datasource.m1.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.m1.driver-class-name=com.mysql.cj.jdbc.Driver
spring.shardingsphere.datasource.m1.jdbc-url=jdbc:mysql://localhost:3306/course_db?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT
spring.shardingsphere.datasource.m1.username=root
spring.shardingsphere.datasource.m1.password=root
spring.shardingsphere.sharding.tables.course.database-strategy.standard.sharding-column=create_time
spring.shardingsphere.sharding.tables.course.database-strategy.standard.precise-algorithm-class-name=com.shardingjdbcdemo.config.CourseTableShardingAlgorithm
spring.shardingsphere.sharding.tables.course.database-strategy.standard.range-algorithm-class-name=com.shardingjdbcdemo.config.CourseTableShardingAlgorithm
spring.shardingsphere.sharding.tables.course.actual-data-nodes=m1.course_${202001..202008}
spring.shardingsphere.sharding.tables.course.key-generator.column=cid
spring.shardingsphere.sharding.tables.course.key-generator.type=SNOWFLAKE
spring.shardingsphere.sharding.tables.course.table-strategy.inline.sharding-column=create_time
spring.shardingsphere.sharding.tables.course.table-strategy.inline.algorithm-expression=course_${202001..202008}
spring.shardingsphere.props.sql.show=true
The database has been created course_202008 table,Error inserting datagram:
org.mybatis.spring.MyBatisSystemException: nested exception is
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: java.lang.IllegalStateException:
Missing the data source name: 'course_202008'
### The error may involve
com.atguigu.shardingjdbcdemo.mapper.CourseMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO course ( cname, user_id, cstatus, create_time )
VALUES ( ?, ?, ?, ? )
### Cause: java.lang.IllegalStateException: Missing the data source name:
'course_202008'
----------------------------------------------------------------
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:
[email protected]