shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

Why is the dataSource not initialized when the service starts?

Open bulletqi opened this issue 1 year ago • 1 comments

Question

I used Springboot2.7.18 and version 5.5.0 of shardingsphere-jdbc5.5.0 with relevant configurations, but the data source of the database is not initialized when the service starts. It is only initialized when the database is accessed for the first time, which can cause slow service execution. Is this determined by the configuration or is it designed to be like this?

bulletqi avatar Jun 21 '24 09:06 bulletqi

In springboot, Hikari connection pool is used by default. When your application does not try to getConnection from Hikari, Hikari is not initialized, and the ShardingSphereDataSource object is not created. Therefore, ShardingSphere cannot pre-acquire the connection from the DB.

RaigorJiang avatar Jun 27 '24 04:06 RaigorJiang

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.

github-actions[bot] avatar Jul 15 '24 20:07 github-actions[bot]