Results 1 to 2 of 2
  1. #1
    Rupali Muley is offline Member
    Join Date
    Jun 2014
    Posts
    1
    Rep Power
    0

    Default How to select database at runtime in hibernate

    I am working on web application which is in hibernate and jsp, servlet . There are different database for each user.I have to modify it in a way that on user login it should select database which is accessible only by particular user . Can anybody have some suggestions?

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,030
    Rep Power
    6

    Default Re: How to select database at runtime in hibernate

    Alternative suggestion: learn how to connect with different databases through Hibernate in the same application (the documentation should tell you how), setup a datasource for each database you have and when logging in make it so the application uses the right datasource/session factory for the logged in user.

    Your problem would have been a hundred times easier to build and maintain if you had one database in which data records or even whole tables are only visible to specific users to be honest.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. how to retrieve data using <select> tag from database
    By shyamgsk in forum Java Servlet
    Replies: 6
    Last Post: 09-20-2013, 04:10 PM
  2. database query(select) question
    By datathinker in forum JDBC
    Replies: 2
    Last Post: 08-23-2013, 10:31 AM
  3. Content from Database at runtime in Jtable
    By Aryanraj in forum AWT / Swing
    Replies: 1
    Last Post: 02-07-2012, 03:40 PM
  4. Replies: 2
    Last Post: 09-25-2011, 11:31 AM
  5. how to populate html:select with values from database
    By sathya_k_83 in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 11-07-2007, 10:53 AM

Posting Permissions

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