← Back to team overview

dhis2-users team mailing list archive

Re: DHIS can't connect to Postgres

 

Hi all,

Here is the standard hibernate file that works for me on a Windows localhost instance of DHIS-2.
You should only have to change the varibles in bold.

hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
hibernate.connection.driver_class = org.postgresql.Driver
hibernate.connection.url = jdbc:postgresql:dhis
hibernate.connection.username = user
hibernate.connection.password = password

hibernate.hbm2ddl.auto = update

From: Dhis2-users [mailto:dhis2-users-bounces+rwilson=msh.org@xxxxxxxxxxxxxxxxxxx] On Behalf Of Uddin Fatema
Sent: Monday, July 29, 2013 6:24 AM
To: Bob Jolliffe
Cc: dhis2-users@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Dhis2-users] DHIS can't connect to Postgres

Dear All,
Please check the hibernet.properties file which is keep inside dhis folder or inside dhis.war file. Several time iface same problem and solved by using this hibernet.properties file.
I am giving one hibernet.properties file here
----------------------
hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
hibernate.connection.driver_class = org.postgresql.Driver
hibernate.connection.url = jdbc:postgresql://localhost:5432/dhis
hibernate.connection.username = username
hibernate.connection.password = passward
hibernate.hbm2ddl.auto = update

hibernate.c3p0.max_size = 50
hibernate.c3p0.min_size = 1
hibernate.c3p0.timeout = 100
hibernate.c3p0.max_statements = 0
hibernate.c3p0.idle_test_period = 3000
hibernate.c3p0.acquire_increment = 1
hibernate.c3p0.max_statements_per_connection = 0
hibernate.c3p0.validate = false
hibernate.connection.release_mode = after_transaction
----------------
additionally,  i attached one hibernet.properties file here. Check it, i believe it will ward

On Fri, Jul 26, 2013 at 4:18 PM, Bob Jolliffe <bobjolliffe@xxxxxxxxx<mailto:bobjolliffe@xxxxxxxxx>> wrote:
No you don't.  local is for unix domain sockets which are not used by java.  Also windoze doesn't have them either so I doubt if this line has any effect at all.

If Roger is authenticating through pgadmin on windows then he must be connecting via tcp (host or hostssl line in pg_hba.conf) so it should be the same route taken by java.

Roger, if my earlier suggestion didn't work send a copy of your pg_hba.conf file so we can have a look.  I must confess I have no idea what the default one looks like on windows.

On 26 July 2013 12:12, Morten Olav Hansen <mortenoh@xxxxxxxxx<mailto:mortenoh@xxxxxxxxx>> wrote:
Did you switch to using md5 auth in pg_hba.conf?

local   all             all                                     md5

Not sure what's the default on windows, but on Ubuntu you always have to do that..

--
Morten

On Fri, Jul 26, 2013 at 5:09 PM, Friedman, Roger (CDC/CGH/DGHA) (CTR) <rdf4@xxxxxxx<mailto:rdf4@xxxxxxx>> wrote:
We have a new 64-bit installation: Windows, Tomcat7, Postgres9.2.  hibernate.properties like manual, connection //localhost:8080/dhis.  Tomcat log shows authentication error making connection, and login rejection can be seen in Postgres log.  This happens with 2 different username/password pairs, both of which work when used with pgAdmin.  Any ideas?

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-users
Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx<mailto:dhis2-users@xxxxxxxxxxxxxxxxxxx>
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp


_______________________________________________
Mailing list: https://launchpad.net/~dhis2-users
Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx<mailto:dhis2-users@xxxxxxxxxxxxxxxxxxx>
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp


_______________________________________________
Mailing list: https://launchpad.net/~dhis2-users
Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx<mailto:dhis2-users@xxxxxxxxxxxxxxxxxxx>
Unsubscribe : https://launchpad.net/~dhis2-users
More help   : https://help.launchpad.net/ListHelp



--

Fatema Uddin
----------------------------------------
Technical Advisor HIS
Priority Area Health
Deutsche Gesellschaft für Internationale Zusammenarbeit (GIZ) GmbH
House10/A, Road 90, Gulshan 2, Dhaka 1212, Bangladesh
Office location:
Room # 304, Shshid Dr.Milan Bhavan,                              Management Information System,
Directorate General of Health Services of MoHFW,
Mohakhali, Dhaka-1212, Bangladesh

Phone: +880 2 881 64 59
Fax:   +880 2 881 38 75

References