Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 4FB649FB340 for ; Tue, 26 Sep 2006 10:25:30 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 41892-02 for ; Tue, 26 Sep 2006 10:25:25 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from socrates.thinkhost.com (mailpipe.socrates.thinkhost.com [64.40.100.194]) by postgresql.org (Postfix) with ESMTP id 5427E9F9ECF for ; Tue, 26 Sep 2006 10:25:24 -0300 (ADT) Received: from geier (adsl-64-91-71-139-rb.lax.customer.centurytel.net [64.91.71.139]) by socrates.thinkhost.com (8.13.6/8.13.5) with SMTP id k8QDOS4A095041 for ; Tue, 26 Sep 2006 09:24:29 -0400 (EDT) (envelope-from jgeier@apt-cafm.com) Message-ID: <005a01c6e16f$36655d70$6700a8c0@geier> From: "Jeanna Geier" To: Subject: Beginner's Question: No pg_hba.conf entry for host...SSL Off Date: Tue, 26 Sep 2006 08:25:18 -0500 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962 X-Antivirus: avast! (VPS 0639-2, 09/26/2006), Outbound message X-Antivirus-Status: Clean X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.02 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200609/285 X-Sequence-Number: 23199 Hi All- I am hoping for some help on this one... we are in the process of implementing our program with SSL enabled on the Postgres side of things. I can start and connect to the database from the command line ok using my current configuration: C:\msys\1.0\local\pgsql\bin>psql -d apt -U postgres Welcome to psql 8.0.8, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help with psql commands \g or terminate with semicolon to execute query \q to quit SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256) Warning: Console code page (437) differs from Windows code page (1252) 8-bit characters may not work correctly. See psql reference page "Notes for Windows users" for details. apt=# However, when I try to run our application to and connect to the database, I am receiving the following error: Connection rejected: FATAL: no pg_hba.conf entry for host "127.0.0.1", user "postgres", database "apt", SSL off. Here is my pg_hba.conf file: # TYPE DATABASE USER CIDR-ADDRESS METHOD # IPv4 local connections: #host all all 127.0.0.1/32 trust # IPv6 local connections: hostssl all all 127.0.0.1/32 trust I'm assuming that I have to put some code in my program to enable this connection besides just putting it in the conf file...but where exactly would this go? Below is an excerpt of our connection code: public class DatabaseConnection { private static String DB_IP; private static final String DB_PORT = "5432"; private static String DB_CATALOG = "apt"; private static final String DB_USER = "postgres"; private static final String DB_PASSWORD = "XXXX"; public static void initIPAddress(String address){ DB_IP = address; } public static void initCatalog(String catalog){ DB_CATALOG = catalog; } public static Connection initialize() throws SQLException { final Connection connection; Properties prop = new Properties(); String url; try{ Class.forName("org.postgresql.Driver"); //url = "jdbc:postgresql://64.34.162.40:5432/apt"; url = "jdbc:postgresql://" + DB_IP + ":" + DB_PORT + "/" + DB_CATALOG; //prop.setProperty("user","postgres"); //prop.setProperty("password", "XXXX"); prop.setProperty("user", DB_USER); prop.setProperty("password", DB_PASSWORD); connection = DriverManager.getConnection(url, prop); connection.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); if(connection == null){ throw new Exception(); } Thread maintainConn = new Thread(new Runnable(){ public void run(){ while(connection != null){ try{ maintainConnection(connection); //10 minutes Thread.sleep(600000); } catch(InterruptedException ie){} } } }); maintainConn.setDaemon(true); maintainConn.start(); } catch(ClassNotFoundException cnf){ throw new SQLException(cnf.getMessage()); } catch(Exception e){ throw new SQLException(e.getMessage()); } return connection; } Thanks in advance for your time and help. As always, this mailing list is the best!! -Jeanna