on-internet
← Community

How to configure multiple DataSources (JPA + JdbcTemplate) in Spring Boot?

Stack Overflow ·

I have an existing Spring Boot application that uses Spring Data JPA with a configured DataSource. Now, I need to connect to the same Oracle database using different credentials. The second user has different permissions, and I only need JdbcTemplate for this connection (no JPA or Hibernate). My requirement: DataSourceJDBC URLCredentialsUsagePrimarySame URLUser ASpring Data JPASecondarySame URLUser BJdbcTemplate The credentials are provided by an external centralized configuration service. Questions: Can I configure two DataSource beans with the same JDBC URL but different credentials? Can I k

Comments

Sign in or sign up to comment and upvote.

No comments yet.