can I configure multiple Database configuration in spring boot project
            Asked
            
        
        
            Active
            
        
            Viewed 158 times
        
    1 Answers
0
            
            
        Yes it is possible !
You can define multiple data sources in your application YML like below
1)
spring:
  datasource:
    username: username
    password: password
    hikari:
      driver_class_name: oracle.jdbc.driver.OracleDriver (or any other)
      connection_timeout: 30000
      maximum_pool_size: 5
    url: host:port/serviceName 
someOtherKey
  datasource:
    username: username
    password: password
    hikari:
      driver_class_name: oracle.jdbc.driver.OracleDriver
      connection_timeout: 30000
      maximum_pool_size: 5
    url: driverName@host:port/serviceName
You can select which Datasource to pickup or provide via @ConfigurationProperties and @Bean
 
    
    
        Harsh
        
- 812
- 1
- 10
- 23
