Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aq4QS-00035f-HS for pgsql-sql@arkaria.postgresql.org; Tue, 12 Apr 2016 19:56:40 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1aq4QS-0008Gt-3E for pgsql-sql@arkaria.postgresql.org; Tue, 12 Apr 2016 19:56:40 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1apkMl-0005qw-B2 for pgsql-sql@postgresql.org; Mon, 11 Apr 2016 22:31:31 +0000 Received: from mbob.nabble.com ([162.253.133.15]) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1apkMi-0005mb-Ih for pgsql-sql@postgresql.org; Mon, 11 Apr 2016 22:31:30 +0000 Received: from msam.nabble.com (unknown [162.253.133.85]) by mbob.nabble.com (Postfix) with ESMTP id EDE2324FEE89 for ; Mon, 11 Apr 2016 15:18:51 -0700 (PDT) Date: Mon, 11 Apr 2016 15:31:26 -0700 (MST) From: Chris To: pgsql-sql@postgresql.org Message-ID: <1460413886714-5898099.post@n5.nabble.com> Subject: Connection to database failed: FATAL: no pg_hba.conf entry for host MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org Introduction: I am working on an application that connects to a postgres database using the libpq API. As a requirement the remote host uses SSL. The scenario involves two Mac computers. We also have two different users, each with their own account to access the database. On one computer, the application works fine and both users can connect to the database using SSL. On the other computer, both users fail to connect to a database and the =E2= =80=9Cno pg_hba.cong entry for host =E2=80=A6=E2=80=9D error is returned from PQerro= rMessage.=20 All users can connect to the database on both computers using either psql, or pgAdmin. Code Syntax: Development is done on Mac with code written in Cocoa / Objectice-C, and C language.=20 I am using the following include file: #include I create the connection string using the following format. Then=20 NSString *connstr =3D [NSString stringWithFormat:@"sslmode=3D'prefer' host= =3D'%@' port=3D'%@' user=3D'%@' password=3D'%@' dbname=3D'%@'", host, port, user, p= ass, db]; const char *conninfo =3D [connstr cStringUsingEncoding:NSASCIIStringEncodin= g]; PGconn *conn =3D PQconnectdb (conninfo); /* conninfo =3D "sslmode=3D'prefer' host=3D'host.domain.com' port=3D'' user=3D= 'username' password=3D'password' dbname=3D'database'" */ if (PQstatus(conn) !=3D CONNECTION_OK) { // no pg_hba.conf entry for host error occurs } Configuration Settings: pg_hba.conf contains hostssl all all 0.0.0.0/0 md5 postgresql.conf contains ssl on on ssl_cert_file server.crt server.crt=20 ssl_key_file server.key server.key Since I able to connect to both computers using psql and pgAdmin, I suspect the problem is with the connection within the Application. The connection string in the application is correct, and I verified the user name and password being passed properly.=20 -- View this message in context: http://postgresql.nabble.com/Connection-to-da= tabase-failed-FATAL-no-pg-hba-conf-entry-for-host-tp5898099.html Sent from the PostgreSQL - sql mailing list archive at Nabble.com. --=20 Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql