Skip to content

Conversation

@rrobetti
Copy link

Implements Issue: #1779

Copilot AI and others added 9 commits December 10, 2025 16:21
- Add new jdbc-unpooled module to settings.gradle
- Create UnpooledDataSource: simple DataSource using DriverManager
- Create DatasourceConfiguration: configuration bean with calculated settings
- Create DatasourceFactory: factory for creating unpooled datasources
- Add comprehensive tests for unpooled connections
- Add JSpecify dependency to jdbc and jdbc-unpooled modules
- All tests pass (10/10)
- Checkstyle and Spotless pass

Co-authored-by: rrobetti <[email protected]>
- Create jdbc-unpooled.adoc with full documentation
- Update toc.yml to include unpooled datasource section
- Update jdbc.adoc to mention unpooled option
- Update jdbc-connection-pools.adoc table to include unpooled
- Documentation covers installation, configuration, use cases, performance considerations
- Includes examples for migration between pooled and unpooled
- Comprehensive warnings about performance implications

Co-authored-by: rrobetti <[email protected]>
- Add database proxy (CNAM, pgpool, Open J Proxy) as first use case in package-info.java
- Update warning text to mention externalized connection pooling
- Remove production and microservices restrictions (valid with proxies)
- Add note about performance considerations not applying with database proxies
- Update jdbc.adoc warning to include database proxy use case
- Delete ANALYSIS_README.md and IMPLEMENTATION_CHECKLIST.md files

Co-authored-by: rrobetti <[email protected]>
Remove analysis document as requested - no longer needed in the PR.

Co-authored-by: rrobetti <[email protected]>
…ction-pool

Implement jdbc-unpooled module for unpooled database connections in Micronaut SQL
@CLAassistant
Copy link

CLAassistant commented Dec 11, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ rrobetti
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

@EachBean(DatasourceConfiguration.class)
@Requires(condition = JdbcDataSourceEnabled.class)
public DataSource dataSource(DatasourceConfiguration datasourceConfiguration) {
UnpooledDataSource ds = new UnpooledDataSource(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need a delegating UnpooledDataSource? You should simply create a DataSource that is specified (maybe also add some builder option)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rationale for implementing unpolled datasource support is documented here #1779.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand, please describe the reason

@dstepanov
Copy link
Contributor

Please sign CLA

@dstepanov
Copy link
Contributor

Maybe we can implement it without an extra dependency, simply by enable it with some property WDYT @radovanradic

@radovanradic
Copy link
Contributor

Maybe we can implement it without an extra dependency, simply by enable it with some property WDYT @radovanradic

Maybe adding DatasourceFactory in jdbc module that will also have @EachBean(BasicJdbcConfiguration.class) but with condition that BasicJdbcConfiguration.disable-pool=true ?

@rrobetti
Copy link
Author

Maybe we can implement it without an extra dependency, simply by enable it with some property WDYT @radovanradic

Maybe adding DatasourceFactory in jdbc module that will also have @EachBean(BasicJdbcConfiguration.class) but with condition that BasicJdbcConfiguration.disable-pool=true ?

thanks for your comment, how would that look like? Can you provide more info? Should I change this implementation?

@radovanradic
Copy link
Contributor

radovanradic commented Dec 12, 2025

Maybe we can implement it without an extra dependency, simply by enable it with some property WDYT @radovanradic

Maybe adding DatasourceFactory in jdbc module that will also have @EachBean(BasicJdbcConfiguration.class) but with condition that BasicJdbcConfiguration.disable-pool=true ?

thanks for your comment, how would that look like? Can you provide more info? Should I change this implementation?

I think what Denis suggested is there is no need for new module for this. Maybe you can just have UnpooledDatasourceFactory in jdbc module and then just create DataSource or as you named it UnpooledDataSource. And maybe there should be flag to tell whether datasource will be pooled to activate that factory, using condition similar to io.micronaut.jdbc.JdbcDataSourceEnabled but Denis might clarify more what he suggested.
Btw, this looks nice and simple to me.

@rrobetti
Copy link
Author

Maybe we can implement it without an extra dependency, simply by enable it with some property WDYT @radovanradic

Maybe adding DatasourceFactory in jdbc module that will also have @EachBean(BasicJdbcConfiguration.class) but with condition that BasicJdbcConfiguration.disable-pool=true ?

thanks for your comment, how would that look like? Can you provide more info? Should I change this implementation?

I think what Denis suggested is there is no need for new module for this. Maybe you can just have UnpooledDatasourceFactory in jdbc module and then just create DataSource or as you named it UnpooledDataSource. And maybe there should be flag to tell whether datasource will be pooled to activate that factory, using condition similar to io.micronaut.jdbc.JdbcDataSourceEnabled but Denis might clarify more what he suggested.

@dstepanov can you add your take on this?

@dstepanov
Copy link
Contributor

I don’t think we need a new module, maybe just an option like “allow-not-pulling-datasource=true” globally or per datasouce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants