Skip to main content
added 28 characters in body
Source Link
buræquete
  • 14.6k
  • 4
  • 50
  • 92

Wouldn't it work to have multiple datasourcesdata sources defined, and depending on your request, change to the one with the correct schema?

spring.datasource.url = jdbc:oracle:thin:@//maui:1521/xe
spring.datasource.username = schema1
spring.datasource.password = ...

spring.datasource2.url = jdbc:oracle:thin:@//maui:1521/xe
spring.datasource2.username = schema2
spring.datasource2.password = ..

@Bean
@Primary
@ConfigurationProperties(prefix="spring.datasource")
public DataSource schema1() {
    return DataSourceBuilder.create().build();
}

@Bean
@ConfigurationProperties(prefix="spring.datasource2")
public DataSource schema2() {
    return DataSourceBuilder.create().build();
}

Otherwise youyou'd need to kill & re-create the connection to keep using single datasourcethe singular data source, but that would be really slow for your application since it would need reconnecting again and again. It would be better for you to use some NoSQL database to achieve this sorta dynamic data storage.

Wouldn't it work to have multiple datasources defined, and depending on your request, change to the one with correct schema?

spring.datasource.url = jdbc:oracle:thin:@//maui:1521/xe
spring.datasource.username = schema1
spring.datasource.password = ...

spring.datasource2.url = jdbc:oracle:thin:@//maui:1521/xe
spring.datasource2.username = schema2
spring.datasource2.password = ..

@Bean
@Primary
@ConfigurationProperties(prefix="spring.datasource")
public DataSource schema1() {
    return DataSourceBuilder.create().build();
}

@Bean
@ConfigurationProperties(prefix="spring.datasource2")
public DataSource schema2() {
    return DataSourceBuilder.create().build();
}

Otherwise you need to kill & re-create the connection to keep using single datasource, but that would be really slow for your application since reconnecting again and again. It would be better for you to use some NoSQL database to achieve this sorta dynamic data storage.

Wouldn't it work to have multiple data sources defined, and depending on your request, change to the one with the correct schema?

spring.datasource.url = jdbc:oracle:thin:@//maui:1521/xe
spring.datasource.username = schema1
spring.datasource.password = ...

spring.datasource2.url = jdbc:oracle:thin:@//maui:1521/xe
spring.datasource2.username = schema2
spring.datasource2.password = ..

@Bean
@Primary
@ConfigurationProperties(prefix="spring.datasource")
public DataSource schema1() {
    return DataSourceBuilder.create().build();
}

@Bean
@ConfigurationProperties(prefix="spring.datasource2")
public DataSource schema2() {
    return DataSourceBuilder.create().build();
}

Otherwise you'd need to kill & re-create the connection to keep using the singular data source, but that would be really slow for your application since it would need reconnecting again and again. It would be better for you to use some NoSQL database to achieve this sorta dynamic data storage.

Bounty Ended with 25 reputation awarded by CommunityBot
added 98 characters in body
Source Link
buræquete
  • 14.6k
  • 4
  • 50
  • 92

Wouldn't it work to have multiple datasources defined, and depending on your request, change to the one with correct schema?

spring.datasource.url = jdbc:oracle:thin:@//maui:1521/xe
spring.datasource.username = schema1
spring.datasource.password = ...

spring.datasource2.url = jdbc:oracle:thin:@//maui:1521/xe
spring.datasource2.username = schema2
spring.datasource2.password = ..

@Bean
@Primary
@ConfigurationProperties(prefix="spring.datasource")
public DataSource schema1() {
    return DataSourceBuilder.create().build();
}

@Bean
@ConfigurationProperties(prefix="spring.datasource2")
public DataSource schema2() {
    return DataSourceBuilder.create().build();
}

Otherwise you need to kill & re-create the connection to keep using single datasource, but that would be really slow for your application since reconnecting again and again. It would be better for you to use some NoSQL database to achieve this sorta dynamic data storage.

Wouldn't it work to have multiple datasources defined, and depending on your request, change to the one with correct schema?

spring.datasource.url = jdbc:oracle:thin:@//maui:1521/xe
spring.datasource.username = schema1
spring.datasource.password = ...

spring.datasource2.url = jdbc:oracle:thin:@//maui:1521/xe
spring.datasource2.username = schema2
spring.datasource2.password = ..

@Bean
@Primary
@ConfigurationProperties(prefix="spring.datasource")
public DataSource schema1() {
    return DataSourceBuilder.create().build();
}

@Bean
@ConfigurationProperties(prefix="spring.datasource2")
public DataSource schema2() {
    return DataSourceBuilder.create().build();
}

Otherwise you need to kill & re-create the connection to keep using single datasource, but that would be really slow for your application since reconnecting again and again.

Wouldn't it work to have multiple datasources defined, and depending on your request, change to the one with correct schema?

spring.datasource.url = jdbc:oracle:thin:@//maui:1521/xe
spring.datasource.username = schema1
spring.datasource.password = ...

spring.datasource2.url = jdbc:oracle:thin:@//maui:1521/xe
spring.datasource2.username = schema2
spring.datasource2.password = ..

@Bean
@Primary
@ConfigurationProperties(prefix="spring.datasource")
public DataSource schema1() {
    return DataSourceBuilder.create().build();
}

@Bean
@ConfigurationProperties(prefix="spring.datasource2")
public DataSource schema2() {
    return DataSourceBuilder.create().build();
}

Otherwise you need to kill & re-create the connection to keep using single datasource, but that would be really slow for your application since reconnecting again and again. It would be better for you to use some NoSQL database to achieve this sorta dynamic data storage.

added 87 characters in body
Source Link
buræquete
  • 14.6k
  • 4
  • 50
  • 92

Wouldn't it work to have multiple datasources defined, and depending on your request, change to the one with correct schema?

spring.datasource.url = jdbc:oracle:thin:@//maui:1521/xe
spring.datasource.username = schema1
spring.datasource.password = ...

spring.datasource2.url = jdbc:oracle:thin:@//maui:1521/xe
spring.datasource2.username = schema2
spring.datasource2.password = ..

@Bean
@Primary
@ConfigurationProperties(prefix="spring.datasource")
public DataSource schema1() {
    return DataSourceBuilder.create().build();
}

@Bean
@ConfigurationProperties(prefix="spring.datasource2")
public DataSource schema2() {
    return DataSourceBuilder.create().build();
}

Otherwise you need to kill & re-create the connection to keep using single datasource, but that would be really slow for your application since reconnecting again and again.

Wouldn't it work to have multiple datasources defined, and depending on your request, change to the one with correct schema?

spring.datasource.url = jdbc:oracle:thin:@//maui:1521/xe
spring.datasource.username = schema1
spring.datasource.password = ...

spring.datasource2.url = jdbc:oracle:thin:@//maui:1521/xe
spring.datasource2.username = schema2
spring.datasource2.password = ..

@Bean
@Primary
@ConfigurationProperties(prefix="spring.datasource")
public DataSource schema1() {
    return DataSourceBuilder.create().build();
}

@Bean
@ConfigurationProperties(prefix="spring.datasource2")
public DataSource schema2() {
    return DataSourceBuilder.create().build();
}

Otherwise you need to kill & re-create the connection to keep using single datasource.

Wouldn't it work to have multiple datasources defined, and depending on your request, change to the one with correct schema?

spring.datasource.url = jdbc:oracle:thin:@//maui:1521/xe
spring.datasource.username = schema1
spring.datasource.password = ...

spring.datasource2.url = jdbc:oracle:thin:@//maui:1521/xe
spring.datasource2.username = schema2
spring.datasource2.password = ..

@Bean
@Primary
@ConfigurationProperties(prefix="spring.datasource")
public DataSource schema1() {
    return DataSourceBuilder.create().build();
}

@Bean
@ConfigurationProperties(prefix="spring.datasource2")
public DataSource schema2() {
    return DataSourceBuilder.create().build();
}

Otherwise you need to kill & re-create the connection to keep using single datasource, but that would be really slow for your application since reconnecting again and again.

added 59 characters in body
Source Link
buræquete
  • 14.6k
  • 4
  • 50
  • 92
Loading
Source Link
buræquete
  • 14.6k
  • 4
  • 50
  • 92
Loading