Results 1 to 4 of 4
  1. #1
    Marty is offline Member
    Join Date
    May 2007
    Posts
    38
    Rep Power
    0

    Default Hibernate with multiple database

    Hello people
    Does anybody use hibernate to access to a multiple database?
    I searched in internet but I donīt understand and the documentation of hibernate says:


    How do I use multiple databases?
    You must configure multiple SessionFactory instances.
    If you have more information, please tell me

    Marty

  2. #2
    goldhouse is offline Senior Member
    Join Date
    Mar 2007
    Posts
    134
    Rep Power
    0

    Default

    Hibernate has a configuration file called hibernate.properties or hibernate.cfg.xml. There you can specify the properties of database like
    Java Code:
    hibernate.connection.driver_class	jdbc driver class
    hibernate.connection.url	jdbc URL
    hibernate.connection.username	database user
    hibernate.connection.password	database user password
    hibernate.connection.pool_size	maximum number of pooled connections
    By default if you download the hibernate source , it will working on hsqldb.
    I have tried hibernate in oracle, mysql, hsqldb

  3. #3
    pegitha is offline Member
    Join Date
    Apr 2007
    Location
    Indiana
    Posts
    83
    Rep Power
    0

    Default

    I have used Hibernate with two databases. You just need to make two datasources then call the one you need for the specific query. I have most recently been using hibernate with Spring but I looked up some old code and what I did was made two different SessionFactories, and so I would call either one or the other session from the factory.
    session = DBUtil.getABCSession();
    or
    session = DBUtil.getDEFSession();

  4. #4
    shekharreddy is offline Member
    Join Date
    Dec 2008
    Posts
    1
    Rep Power
    0

    Default Hi Guys

    can u help to extracting .tar file in java code? pls

    thanks
    -shekhar

Similar Threads

  1. Hibernate with multiple databases
    By dsr0781 in forum JDBC
    Replies: 5
    Last Post: 06-23-2008, 02:06 PM
  2. Database connectivity in Jave struts with Hibernate
    By sanjay_sharma77 in forum Advanced Java
    Replies: 1
    Last Post: 02-02-2008, 09:41 PM
  3. Replies: 0
    Last Post: 08-15-2007, 02:48 PM
  4. Replies: 4
    Last Post: 08-09-2007, 11:41 PM
  5. Replies: 2
    Last Post: 06-30-2007, 04:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •