3

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

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

2
  • Can you qualify what you mean by "multiple databases?" Is this multiple schemas on the same server? Or distinct servers? Commented Oct 11, 2016 at 20:41
  • Apache Drill can do just that, allowing for SQL joins across differing data (e.g. a CSV file paired with a remote SQL database, within the same query). Drill is really targeted at distributed 'Big-Data' multi-machine clustering, but can also be run in 'embedded-mode' from the Cli of a single machine, it's written in Java but it doesn't appear to lend itself too well to be embedded in a singular application (it's more a client-to-drill-server model). Commented Oct 4, 2019 at 9:55

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

I'm trying to inject two DBIs for two mysql data sources but I keep getting the below error:

A binding to org.skife.jdbi.v2.DBI was already configured at com.mmt.clm.ClmModule.provideDBI(). at com.mmt.clm.ClmModule.provideMmtDBI

Is there any way to inject multiple DBIs for multiple data sources

1 Comment

It would be best to submit this as a new question instead of an 'answer' to an old question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.