renjiancheng commented on issue #28779: URL: https://github.com/apache/shardingsphere/issues/28779#issuecomment-1771266725
> > ``` > > <dependency> > > <groupId>com.alibaba</groupId> > > <artifactId>druid-spring-boot-starter</artifactId> > > <version>1.2.16</version> > > </dependency> > > ``` > > * To be honest, after looking at your example in [renjiancheng/sharding-jdbc-learn@ce5ae40](https://github.com/renjiancheng/sharding-jdbc-learn/commit/ce5ae4084c27324ec1a07498298352644de15cdb) , I don't understand why you need to use `com.alibaba:druid-spring-boot-starter` instead of `com.alibaba:druid`. You don't configure Druid-specific Spring Boot Starter content in `application.yml` or a Spring Bean. You even actively excluded the configuration in `com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure`. > > > 谢谢,按照你提醒的配置了单表以后确实程序能正常运行了,但是我之前看官方文档说是如果表不需要分库分表不需要单独配置呀?现在是变了吗? > > * FAQ-related content in https://shardingsphere.apache.org/document/5.4.0/en/faq/ is obsolete, and all FAQ-related content is now located directly on the Github Wiki. This FAQ has not been removed only because [Move FAQ from document to wiki page #19383](https://github.com/apache/shardingsphere/issues/19383) is not completed. > * Call @Swastyy, can we remove the FAQ page at the milestone of ShardingSphere 5.4.2? > > > and the table user is truly exsit, but why sql execute error and print 'Cause: java.sql.SQLException: Table 'user' doesn't exist'? > > * Starting with ShardingSphere 5.4.0, all database tables that are not configured with `RULES` are not automatically loaded into ShardingSphere's metadata. Refer to https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/yaml-config/rules/single/ . > > > i only config a singe datasource of druid , but every time i try to use a database connection the druid and hikari are both inited, why hikari datasource inited? > > * This is completely reasonable. In fact, inside the initialized HikariCP DataSource you see is the ShardingSphere Standalone Mode initialized H2Database DataSource, which holds ShardingSphere metadata. If you switch to ShardingSphere Cluster Mode that uses any third-party metadata center, you will find that the same structure of data is stored in Zookeeper, Etcd, or another third-party metadata center. ShardingSphere implements reading and dynamic refresh of ShardingSphere's configuration through an SPI from a separate metadata center. This is reflected in the use of ContextManager within ShardingSphere JDBC and is further wrapped in DistSQL in ShardingSphere Proxy. > * In general, HikariCP's DataSources were created because Standalone Mode required it, and ShardingSphere relies on HikariCP. If you don't want to see HikariCP data sources created, you'll need to implement SPI for Standalone Mode. @zhanglinsong 加载hikari数据源是因为使用了standalone模式,默认使用它来连接h2维护shardingsphere元数据的,初始化逻辑在`org.apache.shardingsphere.mode.repository.standalone.jdbc.JDBCRepository`类里。 @linghengqian thank you! it's very helpful, wish you good luck! -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
