Giter Site home page Giter Site logo

multi-tenant-db's Introduction

Multi Tenant Architecture

Database Approach

Objective

Proof-of-Concept with the goal to provide a Multi Tenant Architecture using Hibernate.

Use Cases Scenarios

  1. Create a Custom Connection Pool for each tenant and make them available to hibernate;
  2. Users log in the application and depending of their Organization the correct tenant will be loaded and select a suitable connection.
  3. Create an operation (ex. some object query) to demonstrate the diferent results since there is a different database/schema for each user.

Tech Stack

  • Hibernate 4.3.10.FINAL
  • Apache DBCP 1.4
  • JSF 2.1.21
  • Servlet 2.5
  • Oracle (Check if you have Oracle Driver in Maven repo, otherwise it will be necessary to intall)

Build and deploy

  1. Create some Oracle databases (different hosts) with some schemas. Be aware to select one of them to be the MAIN database/schema.

  2. Clone this project to your local git.

  3. Open the file /scripts/database.sql, copy and run the commands marked with MAIN for the MAIN database/schema.

  4. Still in the file /scripts/database.sql, for each tenant database/schema copy and run the commands marked with TENANT.

  5. Edit the file /src/main/resources/multi-tenant.properties providing the correct information for each tenant and main to be created (database/schema data).

  6. Open a terminal and follow one of these approaches:

a. Run "mvn clean install" to generate the WAR package to be deployed and copy to the application server;

b. If you have a tomcat installation, change the tomcat settings for your configuration in /pom.xml and run "clean install tomcat:deploy" (Tomcat must be started);

  1. Access, http://app-server-host:app-server-port/multi-tenant-db.

  2. Try out with multiple users, organizations and tenants.

More Information

See javadocs for further information.

multi-tenant-db's People

Contributors

csantos0 avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.