Skip to content

With this simple example a Jaspersoft Dashboard is querying different databases depending on the logged-in user's organization

Notifications You must be signed in to change notification settings

raphpeguet/JRS-demo-dynamic-DB-connection

Repository files navigation

JRS-demo-dynamic-DB-connection

With this simple example a Jaspersoft Dashboard is querying different databases depending on the logged-in user's organization. This sample will only run on a pro version of JasperReports Server (JRS).

INSTALLATION

  1. Download and Import the repository exports in your JasperReports Server Enterprise 6.4 or later
    a. DatasourceSwitch.zip will import the Dashboard and all the resources it uses including the dynamic datasource connection
    b. organization_1_JRSexport includes the sub-organizations, their profile attributes and the users that are needed.
    NOTE: You can import these with jasperadmin user in default organization (under Manage > Organizations and right click on the org name)
  2. Create the DB and import the data.
    a. The sample is configure to run automatically on a bundle install so using the bundled Postgres DB located at Jasperreportserver(version)/postgresql/bin
    b. Download the sql files that includes all the data we need
    c. Create the 3 databases that our Dashboad will use (in Mac, for Windows you will use psql command directly)
    NOTE: The password for the posgres user is postgres
    ./psql -U postgres
    create database brazil;
    create database france;
    create database germany;
    \q
    c. Import the data in the DB we've just created using the following commands
    NOTE: in each command line you may need to change the path to the sql file
    NOTE2: You can ignore the error you may see: ERROR: database "brazil" already exists
    ./psql -U postgres brazil < brazil.sql
    ./psql -U postgres france < france.sql
    ./psql -U postgres germany < germany.sql

DEMO

Once you have created the DBs and imported the resources in JRS you are ready to test the dynamic DB connection by viewing the Public/Source Switch/Freight Dashboard being logged as brazilian_user then french_user and then german_user.
Note how the data is different and notice that each user will only see the data from their respective DB.

About

With this simple example a Jaspersoft Dashboard is querying different databases depending on the logged-in user's organization

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published