Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id E66899FB423 for ; Tue, 26 Sep 2006 12:11:22 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 68597-10 for ; Tue, 26 Sep 2006 15:11:18 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.229]) by postgresql.org (Postfix) with ESMTP id 002D49FB29C for ; Tue, 26 Sep 2006 12:11:17 -0300 (ADT) Received: by wx-out-0506.google.com with SMTP id t13so2327958wxc for ; Tue, 26 Sep 2006 08:11:17 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=RkKJ18TS/gfYmMpVsl+f804SJnCb69RtlQlmOc4EBCbhrbH+ig9YWNi5aUbjkHlK4Oi74DjRaAYELPEv+4Wv6gLKSNLccAp7ezVQ2sNdt7mxAMigg7g0ISr5Pjxgcl/qpw2L0xiADQtLgDHmDczmBuR+ASXTwkSMMmVTK/31uvk= Received: by 10.70.31.6 with SMTP id e6mr902047wxe; Tue, 26 Sep 2006 08:11:16 -0700 (PDT) Received: by 10.70.77.18 with HTTP; Tue, 26 Sep 2006 08:11:16 -0700 (PDT) Message-ID: <9e0a28690609260811l4c4f564aqcc6d9a5cde164b6a@mail.gmail.com> Date: Tue, 26 Sep 2006 11:11:16 -0400 From: "Juan Miguel Paredes" To: "Jeanna Geier" Subject: Re: Beginner's Question: No pg_hba.conf entry for host...SSL Off Cc: pgsql-admin@postgresql.org In-Reply-To: <008701c6e17c$0ec8c1f0$6700a8c0@geier> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <005a01c6e16f$36655d70$6700a8c0@geier> <9e0a28690609260634n76a8a45fo6e5c28be367aad2f@mail.gmail.com> <008701c6e17c$0ec8c1f0$6700a8c0@geier> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.199 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, SPF_PASS X-Spam-Level: X-Archive-Number: 200609/294 X-Sequence-Number: 23208 On 9/26/06, Jeanna Geier wrote: > Hi and thanks so much for the replies!! > > I had perused that doc and google prior to posting and didn't have any luck; > what I tried was the following: > > added: > private static final String DB_SSL_STATUS = "true"; > & > prop.setProperty("ssl", DB_SSL_STATUS); > > ... > 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"; > private static final String DB_SSL_STATUS = "true"; > > 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("ssl", "true"); > prop.setProperty("user", DB_USER); > prop.setProperty("password", DB_PASSWORD); > prop.setProperty("ssl", DB_SSL_STATUS); > > 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; > } > > > However, when I do that, it's throwing an exception from: connection = > DriverManager.getConnection(url, prop); > and I'm getting an error message that says: "The connection attempt failed." > > Any other ideas? > > Much thanks, as always. > -Jeanna Hi, Jeanna. Maybe an stack-trace of your error, when trying the ssl connection could be useful. Also, as noted in http://jdbc.postgresql.org/documentation/80/ssl-client.html perhaps other jdbc client configuration is missing or not available on your environment. Just guessing... maybe you could try importing your server's certificate into client keystore or disabling SSL certificate validation (probably you're using a self-signed certificate)