0

I have 3 databases(Test1, Test2, Test3) in Oracle. I need to run a query from a table that exists only in Test1 and not in the other databases. How do I configure my service get a session from that particular database using hibernate sessionFactory.

If you need more info, please let me know. Thanks.

  • 4
    I believe that is what you are looking for [http://stackoverflow.com/questions/1921865/how-to-connect-to-multiple-databases-in-hibernate](http://stackoverflow.com/questions/1921865/how-to-connect-to-multiple-databases-in-hibernate) – Anton Vetrov Feb 17 '16 at 19:56
  • That's exactly what I am looking for. Thanks. – Gautham Honnavara Feb 17 '16 at 20:00

1 Answers1

0

Hibernate session factory takes a JDBC URL. The JDBC URL for Oracle contain the database name:

  jdbc:oracle:<drivertype>:@<database>

For example:

dbc:oracle:thin:@myhost:1521:orcl

So you specify which database you connect to via the URL.

JP Moresmau
  • 7,388
  • 17
  • 31