How do I change databases in dhis2?

Hello community!

I am using the the H2 database which I installed from following chapter 8.3.5. on Database configuration. While the guide recommends and points to installation with PostgreSQL DBMS I ended up with H2. So again, How do I change databases in dhis2, moving from H2 to PostgreSQL?

To check which database you’re using go to Profile > About DHIS 2 (Credits to Knut Starring)

I’m getting:

Database type:
DhisH2
Database name:
dhis2;DB_CLOSE_DELAY=-1;MVCC=TRUE;ALIAS_COLUMN_NAME=TRUE;DB_CLOSE_ON_EXIT=FALSE

Thanks,

Adam

Hi Adam, what operating system? Version of DHIS2?

You have to link to your Postgres database inside a file called dhis2.conf. Then you have to create a DHIS2_HOME environment variable that points to the folder containing your dhis2.conf file.

If you are on Ubuntu, you can find some instructions in this conversation:

https://lists.launchpad.net/dhis2-users/msg03085.html

···

On Tue, Mar 22, 2016 at 9:24 PM, Adam Dawoodjee adam.daveed@gmail.com wrote:

Hello community!

I am using the the H2 database which I installed from following chapter 8.3.5. on Database configuration. While the guide recommends and points to installation with PostgreSQL DBMS I ended up with H2. So again, How do I change databases in dhis2, moving from H2 to PostgreSQL?

To check which database you’re using go to Profile > About DHIS 2 (Credits to Knut Starring)

I’m getting:

Database type:
DhisH2
Database name:
dhis2;DB_CLOSE_DELAY=-1;MVCC=TRUE;ALIAS_COLUMN_NAME=TRUE;DB_CLOSE_ON_EXIT=FALSE

Thanks,

Adam


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

Following Knut Staring’s guidance here https://lists.launchpad.net/dhis2-users/msg03086.html. I have:

  1. copied the setenv.sh file from tomcat-dhis/bin/setenv.sh to /usr/share/tomcat
    7/bin/setenv.sh

  2. Completed steps 8.3.5 and 8.3.6 of the implementation guide and placed the dhis.conf file in the /home/dhis/config directory.

But my database still says H2.

···

Kind regards,

Adam

Following Knut Staring's guidance here
https://lists.launchpad.net/dhis2-users/msg03086.html\. I have:

1. copied the setenv.sh file from tomcat-dhis/bin/setenv.sh to
/usr/share/tomcat
7/bin/setenv.sh

What is tomcat-dhis? If that is where your tomcat is residing, then
tomcat-dhis/bin/setenv.sh is the right file. But what is inside that file?

···

On Tue, Mar 22, 2016 at 10:23 PM, Adam Dawoodjee <adam.daveed@gmail.com> wrote:

2. Completed steps *8.3.5 and 8.3.6 of the implementation guide* and *placed
the dhis.conf file in the /home/dhis/config* directory.

But my database still says H2.

Kind regards,
Adam

--
Knut Staring
Dept. of Informatics, University of Oslo
Norway: +4791880522
Skype: knutstar

Hello,

@Gerald I’m running my installation DHIS2 installation on Ubuntu Server 14.04.

@Knut The contents of my /home/dhis/tomcat-dhis are as below:

dhis@websever:~$ ls tomcat-dhis

bin conf logs temp webapps work

Below is my complete environment:

···

On Tue, Mar 22, 2016 at 11:23 PM, Adam Dawoodjee adam.daveed@gmail.com wrote:

Following Knut Staring’s guidance here https://lists.launchpad.net/dhis2-users/msg03086.html. I have:

  1. copied the setenv.sh file from tomcat-dhis/bin/setenv.sh to /usr/share/tomcat
    7/bin/setenv.sh
  1. Completed steps 8.3.5 and 8.3.6 of the implementation guide and placed the dhis.conf file in the /home/dhis/config directory.

But my database still says H2.

Kind regards,

Adam

Hi Adam,

What is inside your setenv.sh file?

···

On Wed, Mar 23, 2016 at 7:57 AM, Adam Dawoodjee adam.daveed@gmail.com wrote:

Hello,

@Gerald I’m running my installation DHIS2 installation on Ubuntu Server 14.04.

@Knut The contents of my /home/dhis/tomcat-dhis are as below:

dhis@websever:~$ ls tomcat-dhis

bin conf logs temp webapps work

Below is my complete environment:


Web API:
Browse it here
Current user:
admin
Version:
2.21
Build revision:
21057
Build date:
2016-03-22 11:55
User agent:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36
Server date:
2016-03-22 23:11
Last analytics table generation:
Time since last analytics table generation:
Last analytics table runtime:
Environment variable:
DHIS2_HOME
External configuration directory:
/home/dhis/configDatabase type:DhisH2Database name:dhis2;DB_CLOSE_DELAY=-1;MVCC=TRUE;ALIAS_COLUMN_NAME=TRUE;DB_CLOSE_ON_EXIT=FALSE
Database user:
sa
Java opts:
-Xmx7500m -Xms4000m
Java home:
/usr/lib/jvm/java-8-oracle/jre
Java temporary directory:
/home/dhis/tomcat-dhis/temp
Java version:
1.8.0_74
Java vendor:
Oracle Corporation
OS name:
Linux
OS architecture:
amd64
OS version:
4.2.0-34-generic
Server memory:
Mem Total in JVM: 4924 Free in JVM: 2984 Max Limit: 6667
CPU cores:
8


On Tue, Mar 22, 2016 at 11:23 PM, Adam Dawoodjee adam.daveed@gmail.com wrote:

Following Knut Staring’s guidance here https://lists.launchpad.net/dhis2-users/msg03086.html. I have:

  1. copied the setenv.sh file from tomcat-dhis/bin/setenv.sh to /usr/share/tomcat
    7/bin/setenv.sh
  1. Completed steps 8.3.5 and 8.3.6 of the implementation guide and placed the dhis.conf file in the /home/dhis/config directory.

But my database still says H2.

Kind regards,

Adam

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

  1. Why are you running 2.21 and not 2.22?

  2. Do you have a file called hibernate.properties in /home/dhis/config? (It changed name to dhis.conf in 2.22).

What is inside that file?

···

On Wed, Mar 23, 2016 at 8:10 AM, Knut Staring knutst@gmail.com wrote:

Hi Adam,

What is inside your setenv.sh file?

On Wed, Mar 23, 2016 at 7:57 AM, Adam Dawoodjee adam.daveed@gmail.com wrote:

Hello,

@Gerald I’m running my installation DHIS2 installation on Ubuntu Server 14.04.

@Knut The contents of my /home/dhis/tomcat-dhis are as below:

dhis@websever:~$ ls tomcat-dhis

bin conf logs temp webapps work

Below is my complete environment:


Web API:
Browse it here
Current user:
admin
Version:
2.21
Build revision:
21057
Build date:
2016-03-22 11:55
User agent:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36
Server date:
2016-03-22 23:11
Last analytics table generation:
Time since last analytics table generation:
Last analytics table runtime:
Environment variable:
DHIS2_HOME
External configuration directory:
/home/dhis/configDatabase type:DhisH2Database name:dhis2;DB_CLOSE_DELAY=-1;MVCC=TRUE;ALIAS_COLUMN_NAME=TRUE;DB_CLOSE_ON_EXIT=FALSE
Database user:
sa
Java opts:
-Xmx7500m -Xms4000m
Java home:
/usr/lib/jvm/java-8-oracle/jre
Java temporary directory:
/home/dhis/tomcat-dhis/temp
Java version:
1.8.0_74
Java vendor:
Oracle Corporation
OS name:
Linux
OS architecture:
amd64
OS version:
4.2.0-34-generic
Server memory:
Mem Total in JVM: 4924 Free in JVM: 2984 Max Limit: 6667
CPU cores:
8



Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

On Tue, Mar 22, 2016 at 11:23 PM, Adam Dawoodjee adam.daveed@gmail.com wrote:

Following Knut Staring’s guidance here https://lists.launchpad.net/dhis2-users/msg03086.html. I have:

  1. copied the setenv.sh file from tomcat-dhis/bin/setenv.sh to /usr/share/tomcat
    7/bin/setenv.sh
  1. Completed steps 8.3.5 and 8.3.6 of the implementation guide and placed the dhis.conf file in the /home/dhis/config directory.

But my database still says H2.

Kind regards,

Adam

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

My /home/dhis/tomcat-dhis/bin/setenv.sh contains:

#!/bin/sh

CATALINA_HOME=/usr/share/tomcat7

export JAVA_HOME=‘/usr/lib/jvm/java-8-oracle/’

export JAVA_OPTS=‘-Xmx7500m -Xms4000m’

export DHIS2_HOME=‘/home/dhis/config’

The first existing directory is used for JAVA_HOME (if JAVA_HOM

E is not

defined in $DEFAULT)

JDK_DIRS="/usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-sun /us

r/lib/jvm/java-1.5.0-sun /usr/lib/j2sdk1.5-sun /usr/lib/j2sdk1.5-

ibm"

Look for the right JVM to use

for jdir in $JDK_DIRS; do

if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then
    JAVA_HOME_TMP="$jdir"
    # checks for a real JDK like environment, needed to check

if

    # really the java-gcj-compat-dev package is installed
    if [ -r "$jdir/bin/jdb" ]; then
        JAVA_HOME="$JAVA_HOME_TMP"
    fi
fi

done

Default Java options

if [ -z “$JAVA_OPTS” ]; then

    JAVA_OPTS="-Djava.awt.headless=true -Xmx128M"

fi

And just in case my /home/dhis/config/dhis.conf contains:

Hibernate SQL dialect

connection.dialect = org.hibernate.dialect.PostgreSQLDialect

JDBC driver class

connection.driver_class = org.postgresql.Driver

JDBC driver connection URL

connection.url = jdbc:postgresql:dhis2

Database username

connection.username = dhis

Database password

connection.password = mal@Gov16

Database schema behavior, can be validate, update, create, crea

te-drop

connection.schema = update

Encryption password (sensitive)

encryption.password = m!N!stryOfAgr!c16@MAL

File store provider. Currently ‘filesystem’ and ‘aws-s3’ are su

pported.

filestore.provider = filesystem

Directory / bucket name. Refers to subdirectory in external dir

ectory on file system and bucket on AWS S3.

filestore.container = files

Thank you,
Adam

···

On Wed, Mar 23, 2016 at 9:10 AM, Knut Staring knutst@gmail.com wrote:

Hi Adam,

What is inside your setenv.sh file?

On Wed, Mar 23, 2016 at 7:57 AM, Adam Dawoodjee adam.daveed@gmail.com wrote:

Hello,

@Gerald I’m running my installation DHIS2 installation on Ubuntu Server 14.04.

@Knut The contents of my /home/dhis/tomcat-dhis are as below:

dhis@websever:~$ ls tomcat-dhis

bin conf logs temp webapps work

Below is my complete environment:


Web API:
Browse it here
Current user:
admin
Version:
2.21
Build revision:
21057
Build date:
2016-03-22 11:55
User agent:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36
Server date:
2016-03-22 23:11
Last analytics table generation:
Time since last analytics table generation:
Last analytics table runtime:
Environment variable:
DHIS2_HOME
External configuration directory:
/home/dhis/configDatabase type:DhisH2Database name:dhis2;DB_CLOSE_DELAY=-1;MVCC=TRUE;ALIAS_COLUMN_NAME=TRUE;DB_CLOSE_ON_EXIT=FALSE
Database user:
sa
Java opts:
-Xmx7500m -Xms4000m
Java home:
/usr/lib/jvm/java-8-oracle/jre
Java temporary directory:
/home/dhis/tomcat-dhis/temp
Java version:
1.8.0_74
Java vendor:
Oracle Corporation
OS name:
Linux
OS architecture:
amd64
OS version:
4.2.0-34-generic
Server memory:
Mem Total in JVM: 4924 Free in JVM: 2984 Max Limit: 6667
CPU cores:
8



Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

On Tue, Mar 22, 2016 at 11:23 PM, Adam Dawoodjee adam.daveed@gmail.com wrote:

Following Knut Staring’s guidance here https://lists.launchpad.net/dhis2-users/msg03086.html. I have:

  1. copied the setenv.sh file from tomcat-dhis/bin/setenv.sh to /usr/share/tomcat
    7/bin/setenv.sh
  1. Completed steps 8.3.5 and 8.3.6 of the implementation guide and placed the dhis.conf file in the /home/dhis/config directory.

But my database still says H2.

Kind regards,

Adam

I dont have the /home/dhis/config/hibernate.properties file. And don’t know what should go in there. I’m running 2.21 as thats what was in the install docs, I thought because its the current stable release.

Do you recommend that I switch to 2.22? If so is it just a matter of replacing the ROOT.war file and dhis directory under webapps?

···

On Wed, Mar 23, 2016 at 9:20 AM, Adam Dawoodjee adam.daveed@gmail.com wrote:

My /home/dhis/tomcat-dhis/bin/setenv.sh contains:

#!/bin/sh

CATALINA_HOME=/usr/share/tomcat7

export JAVA_HOME=‘/usr/lib/jvm/java-8-oracle/’

export JAVA_OPTS=‘-Xmx7500m -Xms4000m’

export DHIS2_HOME=‘/home/dhis/config’

The first existing directory is used for JAVA_HOME (if JAVA_HOM

E is not

defined in $DEFAULT)

JDK_DIRS="/usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-sun /us

r/lib/jvm/java-1.5.0-sun /usr/lib/j2sdk1.5-sun /usr/lib/j2sdk1.5-

ibm"

Look for the right JVM to use

for jdir in $JDK_DIRS; do

if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then
    JAVA_HOME_TMP="$jdir"
    # checks for a real JDK like environment, needed to check

if

    # really the java-gcj-compat-dev package is installed
    if [ -r "$jdir/bin/jdb" ]; then
        JAVA_HOME="$JAVA_HOME_TMP"
    fi
fi

done

Default Java options

if [ -z “$JAVA_OPTS” ]; then

    JAVA_OPTS="-Djava.awt.headless=true -Xmx128M"

fi

And just in case my /home/dhis/config/dhis.conf contains:

Hibernate SQL dialect

connection.dialect = org.hibernate.dialect.PostgreSQLDialect

JDBC driver class

connection.driver_class = org.postgresql.Driver

JDBC driver connection URL

connection.url = jdbc:postgresql:dhis2

Database username

connection.username = dhis

Database password

connection.password = mal@Gov16

Database schema behavior, can be validate, update, create, crea

te-drop

connection.schema = update

Encryption password (sensitive)

encryption.password = m!N!stryOfAgr!c16@MAL

File store provider. Currently ‘filesystem’ and ‘aws-s3’ are su

pported.

filestore.provider = filesystem

Directory / bucket name. Refers to subdirectory in external dir

ectory on file system and bucket on AWS S3.

filestore.container = files

Thank you,
Adam

On Wed, Mar 23, 2016 at 9:10 AM, Knut Staring knutst@gmail.com wrote:

Hi Adam,

What is inside your setenv.sh file?

On Wed, Mar 23, 2016 at 7:57 AM, Adam Dawoodjee adam.daveed@gmail.com wrote:

Hello,

@Gerald I’m running my installation DHIS2 installation on Ubuntu Server 14.04.

@Knut The contents of my /home/dhis/tomcat-dhis are as below:

dhis@websever:~$ ls tomcat-dhis

bin conf logs temp webapps work

Below is my complete environment:


Web API:
Browse it here
Current user:
admin
Version:
2.21
Build revision:
21057
Build date:
2016-03-22 11:55
User agent:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36
Server date:
2016-03-22 23:11
Last analytics table generation:
Time since last analytics table generation:
Last analytics table runtime:
Environment variable:
DHIS2_HOME
External configuration directory:
/home/dhis/configDatabase type:DhisH2Database name:dhis2;DB_CLOSE_DELAY=-1;MVCC=TRUE;ALIAS_COLUMN_NAME=TRUE;DB_CLOSE_ON_EXIT=FALSE
Database user:
sa
Java opts:
-Xmx7500m -Xms4000m
Java home:
/usr/lib/jvm/java-8-oracle/jre
Java temporary directory:
/home/dhis/tomcat-dhis/temp
Java version:
1.8.0_74
Java vendor:
Oracle Corporation
OS name:
Linux
OS architecture:
amd64
OS version:
4.2.0-34-generic
Server memory:
Mem Total in JVM: 4924 Free in JVM: 2984 Max Limit: 6667
CPU cores:
8



Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

On Tue, Mar 22, 2016 at 11:23 PM, Adam Dawoodjee adam.daveed@gmail.com wrote:

Following Knut Staring’s guidance here https://lists.launchpad.net/dhis2-users/msg03086.html. I have:

  1. copied the setenv.sh file from tomcat-dhis/bin/setenv.sh to /usr/share/tomcat
    7/bin/setenv.sh
  1. Completed steps 8.3.5 and 8.3.6 of the implementation guide and placed the dhis.conf file in the /home/dhis/config directory.

But my database still says H2.

Kind regards,

Adam

Before changing to 2.22, just rename dhis.conf to hibernate.properties and restart tomcat.

You don’t need ROOT.war. Just stop tomcat, delete the webapps/dhis folder and place the 2.22 war file in webapps.

···

On Wed, Mar 23, 2016 at 8:25 AM, Adam Dawoodjee adam.daveed@gmail.com wrote:

I dont have the /home/dhis/config/hibernate.properties file. And don’t know what should go in there. I’m running 2.21 as thats what was in the install docs, I thought because its the current stable release.

Do you recommend that I switch to 2.22? If so is it just a matter of replacing the ROOT.war file and dhis directory under webapps?

Adam

On Wed, Mar 23, 2016 at 9:20 AM, Adam Dawoodjee adam.daveed@gmail.com wrote:

My /home/dhis/tomcat-dhis/bin/setenv.sh contains:

#!/bin/sh

CATALINA_HOME=/usr/share/tomcat7

export JAVA_HOME=‘/usr/lib/jvm/java-8-oracle/’

export JAVA_OPTS=‘-Xmx7500m -Xms4000m’

export DHIS2_HOME=‘/home/dhis/config’

The first existing directory is used for JAVA_HOME (if JAVA_HOM

E is not

defined in $DEFAULT)

JDK_DIRS="/usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-sun /us

r/lib/jvm/java-1.5.0-sun /usr/lib/j2sdk1.5-sun /usr/lib/j2sdk1.5-

ibm"

Look for the right JVM to use

for jdir in $JDK_DIRS; do

if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then
    JAVA_HOME_TMP="$jdir"
    # checks for a real JDK like environment, needed to check

if

    # really the java-gcj-compat-dev package is installed
    if [ -r "$jdir/bin/jdb" ]; then
        JAVA_HOME="$JAVA_HOME_TMP"
    fi
fi

done

Default Java options

if [ -z “$JAVA_OPTS” ]; then

    JAVA_OPTS="-Djava.awt.headless=true -Xmx128M"

fi

And just in case my /home/dhis/config/dhis.conf contains:

Hibernate SQL dialect

connection.dialect = org.hibernate.dialect.PostgreSQLDialect

JDBC driver class

connection.driver_class = org.postgresql.Driver

JDBC driver connection URL

connection.url = jdbc:postgresql:dhis2

Database username

connection.username = dhis

Database password

connection.password = mal@Gov16

Database schema behavior, can be validate, update, create, crea

te-drop

connection.schema = update

Encryption password (sensitive)

encryption.password = m!N!stryOfAgr!c16@MAL

File store provider. Currently ‘filesystem’ and ‘aws-s3’ are su

pported.

filestore.provider = filesystem

Directory / bucket name. Refers to subdirectory in external dir

ectory on file system and bucket on AWS S3.

filestore.container = files

Thank you,
Adam

On Wed, Mar 23, 2016 at 9:10 AM, Knut Staring knutst@gmail.com wrote:

Hi Adam,

What is inside your setenv.sh file?

On Wed, Mar 23, 2016 at 7:57 AM, Adam Dawoodjee adam.daveed@gmail.com wrote:

Hello,

@Gerald I’m running my installation DHIS2 installation on Ubuntu Server 14.04.

@Knut The contents of my /home/dhis/tomcat-dhis are as below:

dhis@websever:~$ ls tomcat-dhis

bin conf logs temp webapps work

Below is my complete environment:


Web API:
Browse it here
Current user:
admin
Version:
2.21
Build revision:
21057
Build date:
2016-03-22 11:55
User agent:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36
Server date:
2016-03-22 23:11
Last analytics table generation:
Time since last analytics table generation:
Last analytics table runtime:
Environment variable:
DHIS2_HOME
External configuration directory:
/home/dhis/configDatabase type:DhisH2Database name:dhis2;DB_CLOSE_DELAY=-1;MVCC=TRUE;ALIAS_COLUMN_NAME=TRUE;DB_CLOSE_ON_EXIT=FALSE
Database user:
sa
Java opts:
-Xmx7500m -Xms4000m
Java home:
/usr/lib/jvm/java-8-oracle/jre
Java temporary directory:
/home/dhis/tomcat-dhis/temp
Java version:
1.8.0_74
Java vendor:
Oracle Corporation
OS name:
Linux
OS architecture:
amd64
OS version:
4.2.0-34-generic
Server memory:
Mem Total in JVM: 4924 Free in JVM: 2984 Max Limit: 6667
CPU cores:
8



Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

On Tue, Mar 22, 2016 at 11:23 PM, Adam Dawoodjee adam.daveed@gmail.com wrote:

Following Knut Staring’s guidance here https://lists.launchpad.net/dhis2-users/msg03086.html. I have:

  1. copied the setenv.sh file from tomcat-dhis/bin/setenv.sh to /usr/share/tomcat
    7/bin/setenv.sh
  1. Completed steps 8.3.5 and 8.3.6 of the implementation guide and placed the dhis.conf file in the /home/dhis/config directory.

But my database still says H2.

Kind regards,

Adam

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

And of course, we need to check the content of your hibernate.properties (aka dhis.conf from 2.22 onwards)

···

On Wed, Mar 23, 2016 at 8:29 AM, Knut Staring knutst@gmail.com wrote:

Before changing to 2.22, just rename dhis.conf to hibernate.properties and restart tomcat.

You don’t need ROOT.war. Just stop tomcat, delete the webapps/dhis folder and place the 2.22 war file in webapps.

On Wed, Mar 23, 2016 at 8:25 AM, Adam Dawoodjee adam.daveed@gmail.com wrote:

I dont have the /home/dhis/config/hibernate.properties file. And don’t know what should go in there. I’m running 2.21 as thats what was in the install docs, I thought because its the current stable release.

Do you recommend that I switch to 2.22? If so is it just a matter of replacing the ROOT.war file and dhis directory under webapps?

Adam


Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

On Wed, Mar 23, 2016 at 9:20 AM, Adam Dawoodjee adam.daveed@gmail.com wrote:

My /home/dhis/tomcat-dhis/bin/setenv.sh contains:

#!/bin/sh

CATALINA_HOME=/usr/share/tomcat7

export JAVA_HOME=‘/usr/lib/jvm/java-8-oracle/’

export JAVA_OPTS=‘-Xmx7500m -Xms4000m’

export DHIS2_HOME=‘/home/dhis/config’

The first existing directory is used for JAVA_HOME (if JAVA_HOM

E is not

defined in $DEFAULT)

JDK_DIRS="/usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-sun /us

r/lib/jvm/java-1.5.0-sun /usr/lib/j2sdk1.5-sun /usr/lib/j2sdk1.5-

ibm"

Look for the right JVM to use

for jdir in $JDK_DIRS; do

if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then
    JAVA_HOME_TMP="$jdir"
    # checks for a real JDK like environment, needed to check

if

    # really the java-gcj-compat-dev package is installed
    if [ -r "$jdir/bin/jdb" ]; then
        JAVA_HOME="$JAVA_HOME_TMP"
    fi
fi

done

Default Java options

if [ -z “$JAVA_OPTS” ]; then

    JAVA_OPTS="-Djava.awt.headless=true -Xmx128M"

fi

And just in case my /home/dhis/config/dhis.conf contains:

Hibernate SQL dialect

connection.dialect = org.hibernate.dialect.PostgreSQLDialect

JDBC driver class

connection.driver_class = org.postgresql.Driver

JDBC driver connection URL

connection.url = jdbc:postgresql:dhis2

Database username

connection.username = dhis

Database password

connection.password = mal@Gov16

Database schema behavior, can be validate, update, create, crea

te-drop

connection.schema = update

Encryption password (sensitive)

encryption.password = m!N!stryOfAgr!c16@MAL

File store provider. Currently ‘filesystem’ and ‘aws-s3’ are su

pported.

filestore.provider = filesystem

Directory / bucket name. Refers to subdirectory in external dir

ectory on file system and bucket on AWS S3.

filestore.container = files

Thank you,
Adam

On Wed, Mar 23, 2016 at 9:10 AM, Knut Staring knutst@gmail.com wrote:

Hi Adam,

What is inside your setenv.sh file?

On Wed, Mar 23, 2016 at 7:57 AM, Adam Dawoodjee adam.daveed@gmail.com wrote:

Hello,

@Gerald I’m running my installation DHIS2 installation on Ubuntu Server 14.04.

@Knut The contents of my /home/dhis/tomcat-dhis are as below:

dhis@websever:~$ ls tomcat-dhis

bin conf logs temp webapps work

Below is my complete environment:


Web API:
Browse it here
Current user:
admin
Version:
2.21
Build revision:
21057
Build date:
2016-03-22 11:55
User agent:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36
Server date:
2016-03-22 23:11
Last analytics table generation:
Time since last analytics table generation:
Last analytics table runtime:
Environment variable:
DHIS2_HOME
External configuration directory:
/home/dhis/configDatabase type:DhisH2Database name:dhis2;DB_CLOSE_DELAY=-1;MVCC=TRUE;ALIAS_COLUMN_NAME=TRUE;DB_CLOSE_ON_EXIT=FALSE
Database user:
sa
Java opts:
-Xmx7500m -Xms4000m
Java home:
/usr/lib/jvm/java-8-oracle/jre
Java temporary directory:
/home/dhis/tomcat-dhis/temp
Java version:
1.8.0_74
Java vendor:
Oracle Corporation
OS name:
Linux
OS architecture:
amd64
OS version:
4.2.0-34-generic
Server memory:
Mem Total in JVM: 4924 Free in JVM: 2984 Max Limit: 6667
CPU cores:
8



Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

On Tue, Mar 22, 2016 at 11:23 PM, Adam Dawoodjee adam.daveed@gmail.com wrote:

Following Knut Staring’s guidance here https://lists.launchpad.net/dhis2-users/msg03086.html. I have:

  1. copied the setenv.sh file from tomcat-dhis/bin/setenv.sh to /usr/share/tomcat
    7/bin/setenv.sh
  1. Completed steps 8.3.5 and 8.3.6 of the implementation guide and placed the dhis.conf file in the /home/dhis/config directory.

But my database still says H2.

Kind regards,

Adam

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

And change all of the passwords while you are at it, since this is a public mailing list!

···

On Wed, Mar 23, 2016 at 8:29 AM, Knut Staring knutst@gmail.com wrote:

Before changing to 2.22, just rename dhis.conf to hibernate.properties and restart tomcat.

You don’t need ROOT.war. Just stop tomcat, delete the webapps/dhis folder and place the 2.22 war file in webapps.


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

On Wed, Mar 23, 2016 at 8:25 AM, Adam Dawoodjee adam.daveed@gmail.com wrote:

I dont have the /home/dhis/config/hibernate.properties file. And don’t know what should go in there. I’m running 2.21 as thats what was in the install docs, I thought because its the current stable release.

Do you recommend that I switch to 2.22? If so is it just a matter of replacing the ROOT.war file and dhis directory under webapps?

Adam


Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

On Wed, Mar 23, 2016 at 9:20 AM, Adam Dawoodjee adam.daveed@gmail.com wrote:

My /home/dhis/tomcat-dhis/bin/setenv.sh contains:

#!/bin/sh

CATALINA_HOME=/usr/share/tomcat7

export JAVA_HOME=‘/usr/lib/jvm/java-8-oracle/’

export JAVA_OPTS=‘-Xmx7500m -Xms4000m’

export DHIS2_HOME=‘/home/dhis/config’

The first existing directory is used for JAVA_HOME (if JAVA_HOM

E is not

defined in $DEFAULT)

JDK_DIRS="/usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-sun /us

r/lib/jvm/java-1.5.0-sun /usr/lib/j2sdk1.5-sun /usr/lib/j2sdk1.5-

ibm"

Look for the right JVM to use

for jdir in $JDK_DIRS; do

if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then
    JAVA_HOME_TMP="$jdir"
    # checks for a real JDK like environment, needed to check

if

    # really the java-gcj-compat-dev package is installed
    if [ -r "$jdir/bin/jdb" ]; then
        JAVA_HOME="$JAVA_HOME_TMP"
    fi
fi

done

Default Java options

if [ -z “$JAVA_OPTS” ]; then

    JAVA_OPTS="-Djava.awt.headless=true -Xmx128M"

fi

And just in case my /home/dhis/config/dhis.conf contains:

Hibernate SQL dialect

connection.dialect = org.hibernate.dialect.PostgreSQLDialect

JDBC driver class

connection.driver_class = org.postgresql.Driver

JDBC driver connection URL

connection.url = jdbc:postgresql:dhis2

Database username

connection.username = dhis

Database password

connection.password = mal@Gov16

Database schema behavior, can be validate, update, create, crea

te-drop

connection.schema = update

Encryption password (sensitive)

encryption.password = m!N!stryOfAgr!c16@MAL

File store provider. Currently ‘filesystem’ and ‘aws-s3’ are su

pported.

filestore.provider = filesystem

Directory / bucket name. Refers to subdirectory in external dir

ectory on file system and bucket on AWS S3.

filestore.container = files

Thank you,
Adam

On Wed, Mar 23, 2016 at 9:10 AM, Knut Staring knutst@gmail.com wrote:

Hi Adam,

What is inside your setenv.sh file?

On Wed, Mar 23, 2016 at 7:57 AM, Adam Dawoodjee adam.daveed@gmail.com wrote:

Hello,

@Gerald I’m running my installation DHIS2 installation on Ubuntu Server 14.04.

@Knut The contents of my /home/dhis/tomcat-dhis are as below:

dhis@websever:~$ ls tomcat-dhis

bin conf logs temp webapps work

Below is my complete environment:


Web API:
Browse it here
Current user:
admin
Version:
2.21
Build revision:
21057
Build date:
2016-03-22 11:55
User agent:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36
Server date:
2016-03-22 23:11
Last analytics table generation:
Time since last analytics table generation:
Last analytics table runtime:
Environment variable:
DHIS2_HOME
External configuration directory:
/home/dhis/configDatabase type:DhisH2Database name:dhis2;DB_CLOSE_DELAY=-1;MVCC=TRUE;ALIAS_COLUMN_NAME=TRUE;DB_CLOSE_ON_EXIT=FALSE
Database user:
sa
Java opts:
-Xmx7500m -Xms4000m
Java home:
/usr/lib/jvm/java-8-oracle/jre
Java temporary directory:
/home/dhis/tomcat-dhis/temp
Java version:
1.8.0_74
Java vendor:
Oracle Corporation
OS name:
Linux
OS architecture:
amd64
OS version:
4.2.0-34-generic
Server memory:
Mem Total in JVM: 4924 Free in JVM: 2984 Max Limit: 6667
CPU cores:
8



Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

On Tue, Mar 22, 2016 at 11:23 PM, Adam Dawoodjee adam.daveed@gmail.com wrote:

Following Knut Staring’s guidance here https://lists.launchpad.net/dhis2-users/msg03086.html. I have:

  1. copied the setenv.sh file from tomcat-dhis/bin/setenv.sh to /usr/share/tomcat
    7/bin/setenv.sh
  1. Completed steps 8.3.5 and 8.3.6 of the implementation guide and placed the dhis.conf file in the /home/dhis/config directory.

But my database still says H2.

Kind regards,

Adam

Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049

I overlooked that you posted the content of dhis.conf. It seems fine, probably the issue was just the naming of the file.

And as Jason says, you now should immediately change all your passwords, since you have shared them with everyone on the list:

···

On Wed, Mar 23, 2016 at 8:31 AM, Jason Pickering jason.p.pickering@gmail.com wrote:

And change all of the passwords while you are at it, since this is a public mailing list!

On Wed, Mar 23, 2016 at 8:29 AM, Knut Staring knutst@gmail.com wrote:

Before changing to 2.22, just rename dhis.conf to hibernate.properties and restart tomcat.

You don’t need ROOT.war. Just stop tomcat, delete the webapps/dhis folder and place the 2.22 war file in webapps.


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049

On Wed, Mar 23, 2016 at 8:25 AM, Adam Dawoodjee adam.daveed@gmail.com wrote:

I dont have the /home/dhis/config/hibernate.properties file. And don’t know what should go in there. I’m running 2.21 as thats what was in the install docs, I thought because its the current stable release.

Do you recommend that I switch to 2.22? If so is it just a matter of replacing the ROOT.war file and dhis directory under webapps?

Adam


Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

On Wed, Mar 23, 2016 at 9:20 AM, Adam Dawoodjee adam.daveed@gmail.com wrote:

My /home/dhis/tomcat-dhis/bin/setenv.sh contains:

#!/bin/sh

CATALINA_HOME=/usr/share/tomcat7

export JAVA_HOME=‘/usr/lib/jvm/java-8-oracle/’

export JAVA_OPTS=‘-Xmx7500m -Xms4000m’

export DHIS2_HOME=‘/home/dhis/config’

The first existing directory is used for JAVA_HOME (if JAVA_HOM

E is not

defined in $DEFAULT)

JDK_DIRS="/usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-sun /us

r/lib/jvm/java-1.5.0-sun /usr/lib/j2sdk1.5-sun /usr/lib/j2sdk1.5-

ibm"

Look for the right JVM to use

for jdir in $JDK_DIRS; do

if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then
    JAVA_HOME_TMP="$jdir"
    # checks for a real JDK like environment, needed to check

if

    # really the java-gcj-compat-dev package is installed
    if [ -r "$jdir/bin/jdb" ]; then
        JAVA_HOME="$JAVA_HOME_TMP"
    fi
fi

done

Default Java options

if [ -z “$JAVA_OPTS” ]; then

    JAVA_OPTS="-Djava.awt.headless=true -Xmx128M"

fi

And just in case my /home/dhis/config/dhis.conf contains:

Hibernate SQL dialect

connection.dialect = org.hibernate.dialect.PostgreSQLDialect

JDBC driver class

connection.driver_class = org.postgresql.Driver

JDBC driver connection URL

connection.url = jdbc:postgresql:dhis2

Database username

connection.username = dhis

Database password

connection.password = mal@Gov16

Database schema behavior, can be validate, update, create, crea

te-drop

connection.schema = update

Encryption password (sensitive)

encryption.password = m!N!stryOfAgr!c16@MAL

File store provider. Currently ‘filesystem’ and ‘aws-s3’ are su

pported.

filestore.provider = filesystem

Directory / bucket name. Refers to subdirectory in external dir

ectory on file system and bucket on AWS S3.

filestore.container = files

Thank you,
Adam

On Wed, Mar 23, 2016 at 9:10 AM, Knut Staring knutst@gmail.com wrote:

Hi Adam,

What is inside your setenv.sh file?

On Wed, Mar 23, 2016 at 7:57 AM, Adam Dawoodjee adam.daveed@gmail.com wrote:

Hello,

@Gerald I’m running my installation DHIS2 installation on Ubuntu Server 14.04.

@Knut The contents of my /home/dhis/tomcat-dhis are as below:

dhis@websever:~$ ls tomcat-dhis

bin conf logs temp webapps work

Below is my complete environment:


Web API:
Browse it here
Current user:
admin
Version:
2.21
Build revision:
21057
Build date:
2016-03-22 11:55
User agent:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36
Server date:
2016-03-22 23:11
Last analytics table generation:
Time since last analytics table generation:
Last analytics table runtime:
Environment variable:
DHIS2_HOME
External configuration directory:
/home/dhis/configDatabase type:DhisH2Database name:dhis2;DB_CLOSE_DELAY=-1;MVCC=TRUE;ALIAS_COLUMN_NAME=TRUE;DB_CLOSE_ON_EXIT=FALSE
Database user:
sa
Java opts:
-Xmx7500m -Xms4000m
Java home:
/usr/lib/jvm/java-8-oracle/jre
Java temporary directory:
/home/dhis/tomcat-dhis/temp
Java version:
1.8.0_74
Java vendor:
Oracle Corporation
OS name:
Linux
OS architecture:
amd64
OS version:
4.2.0-34-generic
Server memory:
Mem Total in JVM: 4924 Free in JVM: 2984 Max Limit: 6667
CPU cores:
8



Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

On Tue, Mar 22, 2016 at 11:23 PM, Adam Dawoodjee adam.daveed@gmail.com wrote:

Following Knut Staring’s guidance here https://lists.launchpad.net/dhis2-users/msg03086.html. I have:

  1. copied the setenv.sh file from tomcat-dhis/bin/setenv.sh to /usr/share/tomcat
    7/bin/setenv.sh
  1. Completed steps 8.3.5 and 8.3.6 of the implementation guide and placed the dhis.conf file in the /home/dhis/config directory.

But my database still says H2.

Kind regards,

Adam

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

@Knut, Earlier after seeing your solutions on <https://lists.launchpad.net/dhis2-users/msg03086.html> I had copied the dhis.conf file and saved it as hibernate.properties within the same directory.

I have now changed my passwords (system user, postgresql, and encryption key) and updated my hibernate.properties file, I removed /webapps contents, and replaced with DHIS 2.22 war. I have also restarted the postgres server. After restarting the tomcat it loads for quite a while and goes blank.

So I restarted my installation,

  • first I stopped the tomcat server

  • backed up the config/dhis.conf and tomcat-dhis/bin/setenv.sh files

  • removed the tomcat-user instance (tomcat-dhis) by deleting the whole directory, removed the /home/dhis/config directory

  • removed the the postresql user and database, re-added them with new credentials and restarted postgresql (with help from google)

  • created a new tomcat-user instance (create the /home/dhis/tomcat-dhis directory)

  • downloaded dhis.war 2.22 and copied it to /tomcat-dhis/webapps/

  • replaced the setenv.sh in tomcat-dhis/bin/

  • created the /home/dhis/config directory and placed dhis.conf

  • started the Tomcat server

And this worked. I now get the following in About DHIS 2

Database type:
PostgreSQL
Database name:
dhis2
Database user:
dhis

I went over this a number of times and I am not sure what worked. But I strongly suspect that my changed user credentials and DB encryption required were a connection mis-configuration.

The problems/issues this solved are:

  • Changes not persisting beyond Tomcat/Server restart and

  • Failure to add custom logo’s

Thank you for all your help Knut Staring and Jason Pickering.

I have one more issue which I’ll post in a new question.

···

Adam