Can’t Login after restoring sample database

Hello, I have installed POSTGRESQL on my Windows machine and am trying to work with the Sierra Leone sample database. I downloaded and GUNZipped it and used the psql command to create a database called sierra. I changed the database name to sierra in the dhis.conf file and opened the CMD window and typed
psql -d sierra --username=dhis
But when I go to localhost:8080/dhis I get a 404 error.
Can you tell me what else i need to do please?

1 Like

Hi @clairebre!
I assume you are running apace tomcat or another web server, and you are hosting the DHIS2 war on the address you mentioned?

You didn’t explicitly mention importing the Sierra Leone database in your steps above, but I assume you did that right after the step of creating the database? There is one step that needs to be done in the process between creating and importing the data:

  1. Create database
  2. Run the SQL command “CREATE EXTENSION POSTGIS;” on the empty database.
  3. Import the database

Best regards,

1 Like

Hi Markus no I didn’t do that. I could not find any instructions other than this on the Downloads - DHIS2 page

The PostgreSQL file must be gunzipped and can be imported through pgAdmin restore function or with ** psql
-d dbname -U username -f dhis2-db-sierra-leone.sql**.

I created a database called sierra using pgadmin then I tried the pgadmin restore function but I couldn’t get it to work.

Then I opened a CMD window, switched to the postgresql bin directory and used the psql command with dbname sierra and username dhis.

I watched it load and complete. I had figured out earlier how to make it stop after the first error

Looking at the thread you answered, I ran the command psql -d sierra --username=dhis and now have sierra-# in my command window.

When you say ‘Run the SQL command “CREATE EXTENSION POSTGIS;” on the empty database’ how do you do that? I have figured out quite a lot but this is a new language.

Thanks again and apologies for the very basic questions,


Claire F Brereton FACS CEng GAICD MPH

UQ Child Health Research Centre

Ph: +61 419 901107

Skype: clairebrereton


Twitter: clairebre

ORCID 0000-0001-8686-4237


And Markus, to answer your question,

Yes I am running Apache Tomcat. I followed these instructions to set up dhis2

which works up to version 2.29. After that you need the postgis extension which I have now also downloaded. There are a couple of omissions in the instructions which I sorted out with Julhas Sujan.



Hi Claire

It sounds like if you had this working already on 2.29 you are really very close to having it work with 2.30.

As Markus says, you probably have to create the postgis extension within the database. This terminology is a bit weird to be honest. I see you have downloaded the extension but you may still need to enable it within the particular database. That is what “create extension” actually does.

Seeing as how I can see you are able to run the psql command, I suggest you run it like this:

psql -d sierra --username=postgres -c ‘CREATE EXTENSION postgis’

(I am assuming above you have a database superuser called postgres)


OK! Use dhis has these privileges too so I tried but could not run this command and got the following error.
c:\Program Files\PostgreSQL\11\bin>psql -d sierra --username=dhis -c ‘CREATE EXTENSION postgis’
psql: warning: extra command-line argument “EXTENSION” ignored
psql: warning: extra command-line argument “postgis’” ignored
Password for user dhis:
ERROR: unterminated quoted string at or near “'CREATE”
Maybe it should have been " around the command not ’ (from trying a few things afterwards).
HOWEVER I was able to add the extension in pgadmin4.
I then used the psql command to restore the sierra database. That seems to have worked OK.
I guess that I have to change the dhis.conf file to point to the sierra database which I have done
connection.url = jdbc:postgresql:sierra ?
But when I do this I get a 404 error.
Can you help me with this please?
THANKS, Claire

1 Like

Hi Claire

Sorry about the psql error. I am used to working on linux. I just tried on windoze and I do see that it objects to the single quote. Works with “” but you seem to have worked around the issue fine.

The 404 probably means the war file failed to load. Its hard to guess why that might be without looking at the log. If you want to send me a copy to I will have a look. The log file should be called catalina.out. It can be quite big. You can delete it and then restart so it only carries limited data. Also it should zip well.


1 Like

Hi @clairebre,

Hope you are well.

A follow-up on this issue - was it resolved?


Hi James I didn’t quite sort it but had to move on. I restored it but couldn’t open it. I have now put it aside and will look at it again down the track when I have some data to load.

Thanks for asking,


1 Like

So sorry about that… did you manage to send a copy of the log to @bobj?

James I think so - but it feels like a while ago. I am research student and from the support I have received on this site so far I am sure I will be able to sort it out when I need to - which is probably in a year’s time.
I know that what I want to do with DHIS2 is possible now so I will pick it up when I have the data I need - then I can use it to build environmental health indicators which will be an exciting new use of the system (I think !)
Thanks for all your help so far.

1 Like

I hear you @clairebre. I will be here to assist incase you need me to link you up with the experts in the community anytime.