Results 1 to 6 of 6

Thread: Different Databases for different users to separate data?

  1. #1
    Join Date
    Jun 2010
    Posts
    22

    Default Different Databases for different users to separate data?

    Hi everyone!

    I am no total newby to Spring, but I am far from being an expert. I hope you can help me.

    I am planning a web application that will have a start-page with news, infos and the like.
    There will be a login for registered users to access their private data.

    How would you suggest I separate the data of the different users?
    I thought about including in every object the corresponding user. And then manage the access rights in the spring application.
    Then I thought maybe I could use a single database for every user. Then I would not need to manage the access rights. How would I do this in Spring with Hibernate? I used Spring and Hibernate but all my objects were loaded at startup via Hibernate and not when a user logged in...

    What whould you suggest to manage the user data? Any tip is welcome!

    Thank you!
    Dominik

  2. #2
    Join Date
    Dec 2010
    Posts
    315

    Default

    Single database for every user? What if you have 1000 users? That means 1000 databases? 1 million users = 1 million databases?

    Isn't that too much waste of resources? And what database are you going to use? MySQL? You'll probably go for NoSQL type databases then.

    I suggest implementing ACL with Spring Security instead of 1 user per database. You can load specific data depending on the authorized user and the access rights given to the object. Maybe you can start by checking the following tutorial:

    Spring Security 3: Full ACL Tutorial
    http://krams915.blogspot.com/2011/01...-tutorial.html

  3. #3
    Join Date
    Feb 2009
    Posts
    18

    Default

    Quote Originally Posted by Huehnerbrust View Post
    Then I thought maybe I could use a single database for every user. Then I would not need to manage the access rights. How would I do this in Spring with Hibernate? I used Spring and Hibernate but all my objects were loaded at startup via Hibernate and not when a user logged in...
    Nobody does that. That's a nightmare solution.

    You need to implement a session that identifies the user, and an ACL which holds the objects a user is entitled to access. There is no reason why hibernate should fetch all your objects on startup, check your config there is likely an error somewhere, perhaps hidden in your application logic.

  4. #4
    Join Date
    Jun 2010
    Posts
    22

    Default

    Sorry for the question. After some reading it sounds really stupid to me....
    I will do it like you suggested with ACLs.

    Thanks

  5. #5

    Default

    its so nice to visit here a nice thread. Am so impressed with your such a good hard work, its definitely a good and diferent idea for others, you guys are doing good work good luck, keep it up..

    ______________
    Link Building is an important tool of Seo Services.
    Link Building is an important tool of Seo Services.

  6. #6

    Default

    I don't know if this would be the best way to do it, but I would look into developing two separate classes, one to work with each database. That way, anytime you would need to update the data, you could just send the data into each of the classes and each class would update the corresponding database. I know that you would be duplicating some code, and that kind of defeats the purpose of the class, but then again, the customer already is duplicating data in the databases and doesn't want to move to a single database.

    ccie voice
    ccie voice lab
    msp training

Posting Permissions

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