Skip to content

OracleDataSource created by DataSourceBuilder #6124

@cichockimc

Description

@cichockimc

Spring 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
  }

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions