DHIS can't connect to Postgres

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?

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@cdc.gov 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@lists.launchpad.net

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

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

Most likely is trailing spaces at the end of lines in hibernate.properties. Make sure there is no whitespace before the line ending or it will be seen as part of the credential string.

···

On 26 July 2013 12:09, Friedman, Roger (CDC/CGH/DGHA) (CTR) rdf4@cdc.gov 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@lists.launchpad.net

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

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

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@gmail.com wrote:

Did you switch to using md5 auth in pg_hba.conf?

local all all md5


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

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@cdc.gov 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@lists.launchpad.net

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

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

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

···

On Fri, Jul 26, 2013 at 4:18 PM, Bob Jolliffe bobjolliffe@gmail.com 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.


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


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

On 26 July 2013 12:12, Morten Olav Hansen mortenoh@gmail.com wrote:

Did you switch to using md5 auth in pg_hba.conf?

local all all md5


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

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@cdc.gov 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@lists.launchpad.net

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

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

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

···

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@gmail.com 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@gmail.com 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@cdc.gov 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@lists.launchpad.net

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

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


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


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

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

For windows you have to the following two lines in pg_hba.conf

IPv4 local connections:

host all all 127.0.0.1/32 md5

IPv6 local connections:

host all all ::1/128 md5

In the postgresql.conf the following line should be there

listen_addresses = ‘localhost’

I presume that tomcat and postgres are on the same computer.

Hope that will help. Also check the white space in the hibernate file as Bob mentioned.

If not solved send us the tomcat cat log, postgres log, and the .conf files.

Regards

Muhammad Abdul Hannan Khan

Senior Technical Advisor – HIS

Priority Area Health

Deutsche Gesellschaft für Internationale Zusammenarbeit (GIZ) GmbH

House10/A, Road 90, Gulshan 2, Dhaka 1212, Bangladesh

GIZ-DGHS

Room # 304, Shahid Dr. Milon Bhaban

Director General of Health Service of MoHFW

Mohakhali, Dhaka

T +880-2- 8816459, 8816412 ext 118

M+88 01819 239 241

M+88 01534 312 066

F +880-2-8813875

E hannan.khan@giz.de

S hannan.khan.dhaka

···

On Fri, Jul 26, 2013 at 4:12 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Did you switch to using md5 auth in pg_hba.conf?

local all all md5


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

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@cdc.gov 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@lists.launchpad.net

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

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

Thanks for all the help. Hannan Khan’s answer made the difference – setting listen_address in postgresql.conf

···

For windows you have to the following two lines in pg_hba.conf

IPv4 local connections:

host all all 127.0.0.1/32 md5

IPv6 local connections:

host all all ::1/128 md5

In the postgresql.conf the following line should be there

listen_addresses = ‘localhost’

I presume that tomcat and postgres are on the same computer.

Hope that will help. Also check the white space in the hibernate file as Bob mentioned.

If not solved send us the tomcat cat log, postgres log, and the .conf files.

Regards

Muhammad Abdul Hannan Khan

Senior Technical Advisor – HIS

Priority Area Health

Deutsche Gesellschaft für Internationale Zusammenarbeit (GIZ) GmbH

House10/A, Road 90, Gulshan 2, Dhaka 1212, Bangladesh

GIZ-DGHS

Room # 304, Shahid Dr. Milon Bhaban

Director General of Health Service of MoHFW

Mohakhali, Dhaka

T +880-2- 8816459, 8816412 ext 118

M+88 01819 239 241

M+88 01534 312 066

F +880-2-8813875

E hannan.khan@giz.de

S hannan.khan.dhaka

On Fri, Jul 26, 2013 at 4:12 PM, Morten Olav Hansen mortenoh@gmail.com 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@cdc.gov 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@lists.launchpad.net

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

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


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

Ok thats good to know. But I am curious because I would have thought that would have been the default. Can you remember what the default listen_address was in postgresql.conf? If it wasn’t listening at least on localhost then it means its inaccesable in the default install.

···

On 29 July 2013 19:53, Friedman, Roger (CDC/CGH/DGHA) (CTR) rdf4@cdc.gov wrote:

Thanks for all the help. Hannan Khan’s answer made the difference – setting listen_address in postgresql.conf

From: Hannan Khan [mailto:hannank@gmail.com]

Sent: Monday, July 29, 2013 2:33 AM

To: Morten Olav Hansen

Cc: Friedman, Roger (CDC/CGH/DGHA) (CTR); dhis2-users@lists.launchpad.net

Subject: Re: [Dhis2-users] DHIS can’t connect to Postgres

For windows you have to the following two lines in pg_hba.conf

IPv4 local connections:

host all all 127.0.0.1/32 md5

IPv6 local connections:

host all all ::1/128 md5

In the postgresql.conf the following line should be there

listen_addresses = ‘localhost’

I presume that tomcat and postgres are on the same computer.

Hope that will help. Also check the white space in the hibernate file as Bob mentioned.

If not solved send us the tomcat cat log, postgres log, and the .conf files.

Regards

Muhammad Abdul Hannan Khan

Senior Technical Advisor – HIS

Priority Area Health

Deutsche Gesellschaft für Internationale Zusammenarbeit (GIZ) GmbH

House10/A, Road 90, Gulshan 2, Dhaka 1212, Bangladesh

GIZ-DGHS

Room # 304, Shahid Dr. Milon Bhaban

Director General of Health Service of MoHFW

Mohakhali, Dhaka

T +880-2- 8816459, 8816412 ext 118

M+88 01819 239 241

M+88 01534 312 066

F +880-2-8813875

E hannan.khan@giz.de

S hannan.khan.dhaka

On Fri, Jul 26, 2013 at 4:12 PM, Morten Olav Hansen mortenoh@gmail.com 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@cdc.gov 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@lists.launchpad.net

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

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


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


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

The default is * which works in 32-bit but not 64-bit Win 7.

···

From: Friedman, Roger (CDC/CGH/DGHA) (CTR)

Sent: Monday, July 29, 2013 2:54 PM

To: Hannan Khan; Morten Olav Hansen

Cc: dhis2-users@lists.launchpad.net

Subject: RE: [Dhis2-users] DHIS can’t connect to Postgres

Thanks for all the help. Hannan Khan’s answer made the difference – setting listen_address in postgresql.conf

From: Hannan Khan [mailto:hannank@gmail.com]

Sent: Monday, July 29, 2013 2:33 AM

To: Morten Olav Hansen

Cc: Friedman, Roger (CDC/CGH/DGHA) (CTR);
dhis2-users@lists.launchpad.net

Subject: Re: [Dhis2-users] DHIS can’t connect to Postgres

For windows you have to the following two lines in pg_hba.conf

IPv4 local connections:

host all all 127.0.0.1/32 md5

IPv6 local connections:

host all all ::1/128 md5

In the postgresql.conf the following line should be there

listen_addresses = ‘localhost’

I presume that tomcat and postgres are on the same computer.

Hope that will help. Also check the white space in the hibernate file as Bob mentioned.

If not solved send us the tomcat cat log, postgres log, and the .conf files.

Regards

Muhammad Abdul Hannan Khan

Senior Technical Advisor – HIS

Priority Area Health

Deutsche Gesellschaft für Internationale Zusammenarbeit (GIZ) GmbH

House10/A, Road 90, Gulshan 2, Dhaka 1212, Bangladesh

GIZ-DGHS

Room # 304, Shahid Dr. Milon Bhaban

Director General of Health Service of MoHFW

Mohakhali, Dhaka

T +880-2- 8816459, 8816412 ext 118

M+88 01819 239 241

M+88 01534 312 066

F +880-2-8813875

E hannan.khan@giz.de

S hannan.khan.dhaka

On Fri, Jul 26, 2013 at 4:12 PM, Morten Olav Hansen mortenoh@gmail.com 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@cdc.gov 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@lists.launchpad.net

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

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


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