OracleDataSource created by DataSourceBuilder
See original GitHub issueSpring boot version: 1.2.3.RELEASE Language: Groovy, 2.4.3 Oracle driver: ojdbc 14
When an Oracle datasource is created it seems to be missing the username.
OracleConnectionPoolDataSource oracleDataSource = DataSourceBuilder
.create()
.type(OracleConnectionPoolDataSource)
.driverClassName('oracle.jdbc.OracleDriver')
.url('jdbc:oracle:thin:@localhost:1521:xe')
.username('repository')
.password('********')
.build()
Root cause of that is that calculateMatches method BeanPropertyMatches class is unable to link ‘user’ (which is expected by OracleDataSource) with ‘username’ which is provided by DataSourceBuilder.
Simplest workaround:
private DataSource createNewDataSource(DatasourceConnectionDetails details) {
OracleConnectionPoolDataSource oracleDataSource = DataSourceBuilder
.create()
.type(OracleConnectionPoolDataSource)
.driverClassName(details.driverClassName)
.url(details.url)
.password(details.password)
.build()
oracleDataSource.user = 'repository'
oracleDataSource
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Class DataSourceBuilder<T extends DataSource> - Spring
Convenience class for building a DataSource . Provides a limited subset of the properties supported by a typical DataSource as well as detection...
Read more >Spring Boot externalised configuration for DataSource not ...
I have tried to remove @ConfigurationProperties and change app.datasource to spring.datasource . I have also tried to use DataSourceBuilder.
Read more >Data Sources and URLs - Oracle Help Center
Create an OracleDataSource instance, initialize its connection properties as appropriate, and get a connection instance, as in the following example:
Read more >Oracle Connection Pooling With Spring - Baeldung
For versions prior to 11.2, like Oracle 9i or 10g, we should create an OracleDataSource instead of using Oracle's Universal Connection Pooling.
Read more >Configuring Spring Boot for Oracle
Oracle Datasource. The easiest approach is to create a configuration bean in the package structure of your Spring Boot application. This will ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Looks similar to #1384 and I think we should just be able to change:
to include
withAlias("username", "user")
.Wow, what happened back then?! Thanks for pointing that out @vpavic !