javadatabasejdbi

can multiple database connection be build using jdbi


My requirement is too fetch data by joining tables from multiple databases.

Is their any way to setup connection with multiple databases using jbdi


Solution

  • Each DBI instance is tied to a single java.sql.DataSource, which I've only seen connect to a single database. So the answer to your question is, probably not.

    You can however construct a DBI per database, query them separately, and join the result on your application server.

    Depending on your use case (I'm assuming reporting?), it might be more appropriate to look into a data warehouse solution, and set up an ETL (extract, transform, and load) for each of your separate database to feed into the warehouse. Then you can produce reports from the warehouse without impacting performance of the other systems.